diff options
author | andrei kulakov <andrei.avk@gmail.com> | 2022-03-12 12:26:17 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-12 19:26:17 +0200 |
commit | d9db07a3100105768ba83ffd67991e78452bb22e (patch) | |
tree | df9d976c46b01c50d3d7aee81058c40984698b56 /Lib/test | |
parent | af2277e461aee4eb96affd06b4af25aad31c81ea (diff) | |
download | cpython-git-d9db07a3100105768ba83ffd67991e78452bb22e.tar.gz |
bpo-37529: Add test for guessing extensions (GH-28243)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_mimetypes.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_mimetypes.py b/Lib/test/test_mimetypes.py index 4098a22644..392ddd2d5e 100644 --- a/Lib/test/test_mimetypes.py +++ b/Lib/test/test_mimetypes.py @@ -159,6 +159,15 @@ class MimeTypesTestCase(unittest.TestCase): # Poison should be gone. self.assertEqual(mimetypes.guess_extension('foo/bar'), None) + @unittest.skipIf(sys.platform.startswith("win"), "Non-Windows only") + def test_guess_known_extensions(self): + # Issue 37529 + # The test fails on Windows because Windows adds mime types from the Registry + # and that creates some duplicates. + from mimetypes import types_map + for v in types_map.values(): + self.assertIsNotNone(mimetypes.guess_extension(v)) + def test_preferred_extension(self): def check_extensions(): self.assertEqual(mimetypes.guess_extension('application/octet-stream'), '.bin') |