bpo-39299: Add more tests for mimetypes and its cli. (GH-17949)

* Add tests for case insensitive check of types and extensions as fallback.
* Add tests for data url with no comma.
* Add tests for read_mime_types.
* Add tests for the mimetypes cli and refactor __main__ code to private function.
* Restore mimetypes.knownfiles value at the end of the test.
This commit is contained in:
Karthikeyan Singaravelan 2020-01-13 20:09:36 +05:30 committed by GitHub
parent c1ee6e5e9b
commit d8efc14951
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 85 additions and 5 deletions

View file

@ -564,7 +564,7 @@ def _default_mime_types():
_default_mime_types()
if __name__ == '__main__':
def _main():
import getopt
USAGE = """\
@ -608,3 +608,7 @@ More than one type argument may be given.
guess, encoding = guess_type(gtype, strict)
if not guess: print("I don't know anything about type", gtype)
else: print('type:', guess, 'encoding:', encoding)
if __name__ == '__main__':
_main()