Index: Lib/test/test_mimetypes.py =================================================================== --- Lib/test/test_mimetypes.py (revision 82055) +++ Lib/test/test_mimetypes.py (working copy) @@ -62,7 +62,17 @@ all = self.db.guess_all_extensions('image/jpg', strict=True) eq(all, []) + def test_init_reinitializes(self): + # Issue 4936: make sure an init starts clean + # First, put some poison into the types table + self.db.add_type('foo/bar', '.foobar') + self.assertEqual(self.db.guess_extension('foo/bar'), '.foobar') + # Reinitialize + mimetypes.init() + # Poison should be gone. + self.assertEqual(self.db.guess_extension('foo/bar'), None) + @unittest.skipUnless(sys.platform.startswith("win"), "Windows only") class Win32MimeTypesTestCase(unittest.TestCase): def setUp(self):