8000 bpo-37529: Add test for guessing extensions (GH-28243) · python/cpython@d9db07a · GitHub
[go: up one dir, main page]

Skip to content

Commit d9db07a

Browse files
akulakovasvetlov
andauthored
bpo-37529: Add test for guessing extensions (GH-28243)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
1 parent af2277e commit d9db07a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Lib/test/test_mimetypes.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,15 @@ def test_init_reinitializes(self):
159159
# Poison should be gone.
160160
self.assertEqual(mimetypes.guess_extension('foo/bar'), None)
161161

162+
@unittest.skipIf(sys.platform.startswith("win"), "Non-Windows only")
163+
def test_guess_known_extensions(self):
164+
# Issue 37529
165+
# The test fails on Windows because Windows adds mime types from the Registry
166+
# and that creates some duplicates.
167+
from mimetypes import types_map
168+
for v in types_map.values():
169+
self.assertIsNotNone(mimetypes.guess_extension(v))
170+
162171
def test_preferred_extension(self):
163172
def check_extensions():
164173
self.assertEqual(mimetypes.guess_extension('application/octet-stream'), '.bin')

0 commit comments

Comments
 (0)
0