File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -287,6 +287,27 @@ def check_extensions():
287287 mimetypes .init ()
288288 check_extensions ()
289289
290+ def test_guess_file_type (self ):
291+ def check_file_type ():
292+ for mime_type , ext in (
293+ ("application/yaml" , ".yaml" ),
294+ ("application/yaml" , ".yml" ),
295+ ("audio/mpeg" , ".mp2" ),
296+ ("audio/mpeg" , ".mp3" ),
297+ ("video/mpeg" , ".m1v" ),
298+ ("video/mpeg" , ".mpa" ),
299+ ("video/mpeg" , ".mpe" ),
300+ ("video/mpeg" , ".mpeg" ),
301+ ("video/mpeg" , ".mpg" ),
302+ ):
303+ with self .subTest (mime_type = mime_type , ext = ext ):
304+ result , _ = mimetypes .guess_file_type (f"filename{ ext } " )
305+ self .assertEqual (result , mime_type )
306+
307+ check_file_type ()
308+ mimetypes .init ()
309+ check_file_type ()
310+
290311 def test_init_stability (self ):
291312 mimetypes .init ()
292313
You can’t perform that action at this time.
0 commit comments