summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2024-05-05 13:39:50 (GMT)
committerGitHub <noreply@github.com>2024-05-05 13:39:50 (GMT)
commit1511bc95c4bc95bd35599dc9c88111c9aac44c0d (patch)
treeb6359df00255af7d2791c03e6606dcc5d6467992
parentb6f0ab5b1cb6d779efe4867d83a60e8d66c48dee (diff)
downloadcpython-1511bc95c4bc95bd35599dc9c88111c9aac44c0d.zip
cpython-1511bc95c4bc95bd35599dc9c88111c9aac44c0d.tar.gz
cpython-1511bc95c4bc95bd35599dc9c88111c9aac44c0d.tar.bz2
gh-101137: Add `text/x-rst` to `mimetypes` (#118593)
-rw-r--r--Lib/mimetypes.py1
-rw-r--r--Lib/test/test_mimetypes.py1
-rw-r--r--Misc/NEWS.d/next/Library/2024-05-05-16-08-03.gh-issue-101137.71ECXu.rst1
3 files changed, 3 insertions, 0 deletions
diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py
index 021ae98..65a049a 100644
--- a/Lib/mimetypes.py
+++ b/Lib/mimetypes.py
@@ -567,6 +567,7 @@ def _default_mime_types():
'.tsv' : 'text/tab-separated-values',
'.vtt' : 'text/vtt',
'.py' : 'text/x-python',
+ '.rst' : 'text/x-rst',
'.etx' : 'text/x-setext',
'.sgm' : 'text/x-sgml',
'.sgml' : 'text/x-sgml',
diff --git a/Lib/test/test_mimetypes.py b/Lib/test/test_mimetypes.py
index 30e1c56..bf6eae7 100644
--- a/Lib/test/test_mimetypes.py
+++ b/Lib/test/test_mimetypes.py
@@ -214,6 +214,7 @@ class MimeTypesTestCase(unittest.TestCase):
self.assertEqual(mimetypes.guess_extension('text/html'), '.html')
self.assertEqual(mimetypes.guess_extension('text/plain'), '.txt')
self.assertEqual(mimetypes.guess_extension('text/rtf'), '.rtf')
+ self.assertEqual(mimetypes.guess_extension('text/x-rst'), '.rst')
self.assertEqual(mimetypes.guess_extension('video/mpeg'), '.mpeg')
self.assertEqual(mimetypes.guess_extension('video/quicktime'), '.mov')
diff --git a/Misc/NEWS.d/next/Library/2024-05-05-16-08-03.gh-issue-101137.71ECXu.rst b/Misc/NEWS.d/next/Library/2024-05-05-16-08-03.gh-issue-101137.71ECXu.rst
new file mode 100644
index 0000000..3df689b
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-05-05-16-08-03.gh-issue-101137.71ECXu.rst
@@ -0,0 +1 @@
+Mime type ``text/x-rst`` is now supported by :mod:`mimetypes`.