Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
9fc720e5
Kaydet (Commit)
9fc720e5
authored
Haz 24, 2019
tarafından
David K. Hess
Kaydeden (comit)
Steve Dower
Haz 24, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-4963: Fix for initialization and non-deterministic behavior issues in mimetypes (GH-3062)
üst
8bd2872a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
0 deletions
+57
-0
mimetypes.rst
Doc/library/mimetypes.rst
+4
-0
mimetypes.py
Lib/mimetypes.py
+0
-0
test_mimetypes.py
Lib/test/test_mimetypes.py
+51
-0
2017-08-15-11-24-41.bpo-4963.LRYres.rst
...WS.d/next/Library/2017-08-15-11-24-41.bpo-4963.LRYres.rst
+2
-0
No files found.
Doc/library/mimetypes.rst
Dosyayı görüntüle @
9fc720e5
...
@@ -93,6 +93,10 @@ behavior of the module.
...
@@ -93,6 +93,10 @@ behavior of the module.
Specifying an empty list for *files* will prevent the system defaults from
Specifying an empty list for *files* will prevent the system defaults from
being applied: only the well-known values will be present from a built-in list.
being applied: only the well-known values will be present from a built-in list.
If *files* is ``None`` the internal data structure is completely rebuilt to its
initial default value. This is a stable operation and will produce the same results
when called multiple times.
.. versionchanged:: 3.2
.. versionchanged:: 3.2
Previously, Windows registry settings were ignored.
Previously, Windows registry settings were ignored.
...
...
Lib/mimetypes.py
Dosyayı görüntüle @
9fc720e5
This diff is collapsed.
Click to expand it.
Lib/test/test_mimetypes.py
Dosyayı görüntüle @
9fc720e5
...
@@ -79,6 +79,57 @@ class MimeTypesTestCase(unittest.TestCase):
...
@@ -79,6 +79,57 @@ class MimeTypesTestCase(unittest.TestCase):
strict
=
True
)
strict
=
True
)
self
.
assertEqual
(
exts
,
[
'.g3'
,
'.g
\xb3
'
])
self
.
assertEqual
(
exts
,
[
'.g3'
,
'.g
\xb3
'
])
def
test_init_reinitializes
(
self
):
# Issue 4936: make sure an init starts clean
# First, put some poison into the types table
mimetypes
.
add_type
(
'foo/bar'
,
'.foobar'
)
self
.
assertEqual
(
mimetypes
.
guess_extension
(
'foo/bar'
),
'.foobar'
)
# Reinitialize
mimetypes
.
init
()
# Poison should be gone.
self
.
assertEqual
(
mimetypes
.
guess_extension
(
'foo/bar'
),
None
)
def
test_preferred_extension
(
self
):
def
check_extensions
():
self
.
assertEqual
(
mimetypes
.
guess_extension
(
'application/octet-stream'
),
'.bin'
)
self
.
assertEqual
(
mimetypes
.
guess_extension
(
'application/postscript'
),
'.ps'
)
self
.
assertEqual
(
mimetypes
.
guess_extension
(
'application/vnd.apple.mpegurl'
),
'.m3u'
)
self
.
assertEqual
(
mimetypes
.
guess_extension
(
'application/vnd.ms-excel'
),
'.xls'
)
self
.
assertEqual
(
mimetypes
.
guess_extension
(
'application/vnd.ms-powerpoint'
),
'.ppt'
)
self
.
assertEqual
(
mimetypes
.
guess_extension
(
'application/x-texinfo'
),
'.texi'
)
self
.
assertEqual
(
mimetypes
.
guess_extension
(
'application/x-troff'
),
'.roff'
)
self
.
assertEqual
(
mimetypes
.
guess_extension
(
'application/xml'
),
'.xsl'
)
self
.
assertEqual
(
mimetypes
.
guess_extension
(
'audio/mpeg'
),
'.mp3'
)
self
.
assertEqual
(
mimetypes
.
guess_extension
(
'image/jpeg'
),
'.jpg'
)
self
.
assertEqual
(
mimetypes
.
guess_extension
(
'image/tiff'
),
'.tiff'
)
self
.
assertEqual
(
mimetypes
.
guess_extension
(
'message/rfc822'
),
'.eml'
)
self
.
assertEqual
(
mimetypes
.
guess_extension
(
'text/html'
),
'.html'
)
self
.
assertEqual
(
mimetypes
.
guess_extension
(
'text/plain'
),
'.txt'
)
self
.
assertEqual
(
mimetypes
.
guess_extension
(
'video/mpeg'
),
'.mpeg'
)
self
.
assertEqual
(
mimetypes
.
guess_extension
(
'video/quicktime'
),
'.mov'
)
check_extensions
()
mimetypes
.
init
()
check_extensions
()
def
test_init_stability
(
self
):
mimetypes
.
init
()
suffix_map
=
mimetypes
.
suffix_map
encodings_map
=
mimetypes
.
encodings_map
types_map
=
mimetypes
.
types_map
common_types
=
mimetypes
.
common_types
mimetypes
.
init
()
self
.
assertIsNot
(
suffix_map
,
mimetypes
.
suffix_map
)
self
.
assertIsNot
(
encodings_map
,
mimetypes
.
encodings_map
)
self
.
assertIsNot
(
types_map
,
mimetypes
.
types_map
)
self
.
assertIsNot
(
common_types
,
mimetypes
.
common_types
)
self
.
assertEqual
(
suffix_map
,
mimetypes
.
suffix_map
)
self
.
assertEqual
(
encodings_map
,
mimetypes
.
encodings_map
)
self
.
assertEqual
(
types_map
,
mimetypes
.
types_map
)
self
.
assertEqual
(
common_types
,
mimetypes
.
common_types
)
def
test_path_like_ob
(
self
):
def
test_path_like_ob
(
self
):
filename
=
"LICENSE.txt"
filename
=
"LICENSE.txt"
filepath
=
pathlib
.
Path
(
filename
)
filepath
=
pathlib
.
Path
(
filename
)
...
...
Misc/NEWS.d/next/Library/2017-08-15-11-24-41.bpo-4963.LRYres.rst
0 → 100644
Dosyayı görüntüle @
9fc720e5
Fixed non-deterministic behavior related to mimetypes extension mapping and
module reinitialization.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment