summaryrefslogtreecommitdiffstats
path: root/Lib/mimetypes.py
diff options
context:
space:
mode:
authorKarthikeyan Singaravelan <tir.karthi@gmail.com>2020-01-13 14:39:36 (GMT)
committerGitHub <noreply@github.com>2020-01-13 14:39:36 (GMT)
commitd8efc1495194228c3a4cd472200275d6491d8e2d (patch)
tree6d4e6c6def1f31932aea2d1281a557b1ec3cec50 /Lib/mimetypes.py
parentc1ee6e5e9b87c9812c6745c1dd6c1788a984f9f9 (diff)
downloadcpython-d8efc1495194228c3a4cd472200275d6491d8e2d.zip
cpython-d8efc1495194228c3a4cd472200275d6491d8e2d.tar.gz
cpython-d8efc1495194228c3a4cd472200275d6491d8e2d.tar.bz2
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.
Diffstat (limited to 'Lib/mimetypes.py')
-rw-r--r--Lib/mimetypes.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py
index a09e618..e972ca2 100644
--- a/Lib/mimetypes.py
+++ b/Lib/mimetypes.py
@@ -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()