(self)
| 2169 | self.check_unpack_archive('zip', filter='data') |
| 2170 | |
| 2171 | def test_unpack_registry(self): |
| 2172 | |
| 2173 | formats = get_unpack_formats() |
| 2174 | |
| 2175 | def _boo(filename, extract_dir, extra): |
| 2176 | self.assertEqual(extra, 1) |
| 2177 | self.assertEqual(filename, 'stuff.boo') |
| 2178 | self.assertEqual(extract_dir, 'xx') |
| 2179 | |
| 2180 | register_unpack_format('Boo', ['.boo', '.b2'], _boo, [('extra', 1)]) |
| 2181 | unpack_archive('stuff.boo', 'xx') |
| 2182 | |
| 2183 | # trying to register a .boo unpacker again |
| 2184 | self.assertRaises(RegistryError, register_unpack_format, 'Boo2', |
| 2185 | ['.boo'], _boo) |
| 2186 | |
| 2187 | # should work now |
| 2188 | unregister_unpack_format('Boo') |
| 2189 | register_unpack_format('Boo2', ['.boo'], _boo) |
| 2190 | self.assertIn(('Boo2', ['.boo'], ''), get_unpack_formats()) |
| 2191 | self.assertNotIn(('Boo', ['.boo'], ''), get_unpack_formats()) |
| 2192 | |
| 2193 | # let's leave a clean state |
| 2194 | unregister_unpack_format('Boo2') |
| 2195 | self.assertEqual(get_unpack_formats(), formats) |
| 2196 | |
| 2197 | |
| 2198 | class TestMisc(BaseTest, unittest.TestCase): |
nothing calls this directly
no test coverage detected