mirror of
https://github.com/python/cpython.git
synced 2025-09-27 18:59:43 +00:00
bpo-37529: Add test for guessing extensions (GH-28243)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
This commit is contained in:
parent
af2277e461
commit
d9db07a310
1 changed files with 9 additions and 0 deletions
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue