(self)
| 2195 | self.check_unpack_archive('zip', filter='data') |
| 2196 | |
| 2197 | def test_unpack_registry(self): |
| 2198 | |
| 2199 | formats = get_unpack_formats() |
| 2200 | |
| 2201 | def _boo(filename, extract_dir, extra): |
| 2202 | self.assertEqual(extra, 1) |
| 2203 | self.assertEqual(filename, 'stuff.boo') |
| 2204 | self.assertEqual(extract_dir, 'xx') |
| 2205 | |
| 2206 | register_unpack_format('Boo', ['.boo', '.b2'], _boo, [('extra', 1)]) |
| 2207 | unpack_archive('stuff.boo', 'xx') |
| 2208 | |
| 2209 | # trying to register a .boo unpacker again |
| 2210 | self.assertRaises(RegistryError, register_unpack_format, 'Boo2', |
| 2211 | ['.boo'], _boo) |
| 2212 | |
| 2213 | # should work now |
| 2214 | unregister_unpack_format('Boo') |
| 2215 | register_unpack_format('Boo2', ['.boo'], _boo) |
| 2216 | self.assertIn(('Boo2', ['.boo'], ''), get_unpack_formats()) |
| 2217 | self.assertNotIn(('Boo', ['.boo'], ''), get_unpack_formats()) |
| 2218 | |
| 2219 | # let's leave a clean state |
| 2220 | unregister_unpack_format('Boo2') |
| 2221 | self.assertEqual(get_unpack_formats(), formats) |
| 2222 | |
| 2223 | |
| 2224 | class TestMisc(BaseTest, unittest.TestCase): |
nothing calls this directly
no test coverage detected