Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Assert adding MIME type with empty extension emits no warning
  • Loading branch information
hugovk committed Nov 16, 2024
commit bac8d5d69bb963baa25fd6dc3276cd7a525168ac
6 changes: 2 additions & 4 deletions Lib/test/test_mimetypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,10 @@ def test_add_type_with_undotted_extension_raises_exception(self):
with self.assertRaises(ValueError):
mimetypes.add_type('testing/type', 'undotted')

def test_add_type_with_empty_extension_emits_warning(self):
def test_add_type_with_empty_extension_emits_no_warning(self):
with warnings.catch_warnings(record=True) as wlog:
mimetypes.add_type('testing/type', '')
self.assertEqual(len(wlog), 1)
warning = wlog[0]
self.assertEqual(str(warning.message), 'Empty extension specified')
self.assertEqual(len(wlog), 0)


@unittest.skipUnless(sys.platform.startswith("win"), "Windows only")
Expand Down