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
4e553e2e
Kaydet (Commit)
4e553e2e
authored
Kas 15, 2013
tarafından
Nick Coghlan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Avoid triggering the refleak detector
üst
4b9b9364
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
test_codecs.py
Lib/test/test_codecs.py
+14
-8
No files found.
Lib/test/test_codecs.py
Dosyayı görüntüle @
4e553e2e
...
...
@@ -2386,6 +2386,15 @@ class TransformCodecTest(unittest.TestCase):
# currently *only* want this to happen for relatively stateless
# exceptions, where the only significant information they contain is their
# type and a single str argument.
# Use a local codec registry to avoid appearing to leak objects when
# registering multiple seach functions
_TEST_CODECS
=
{}
def
_get_test_codec
(
codec_name
):
return
_TEST_CODECS
.
get
(
codec_name
)
codecs
.
register
(
_get_test_codec
)
# Returns None, not usable as a decorator
class
ExceptionChainingTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
...
...
@@ -2395,19 +2404,16 @@ class ExceptionChainingTest(unittest.TestCase):
# The codecs module normalizes codec names, although this doesn't
# appear to be formally documented...
self
.
codec_name
=
repr
(
self
)
.
lower
()
.
replace
(
" "
,
"-"
)
self
.
codec_info
=
None
codecs
.
register
(
self
.
get_codec
)
def
get_codec
(
self
,
codec_name
):
if
codec_name
!=
self
.
codec_name
:
return
None
return
self
.
codec_info
def
tearDown
(
self
):
_TEST_CODECS
.
pop
(
self
.
codec_name
,
None
)
def
set_codec
(
self
,
obj_to_raise
):
def
raise_obj
(
*
args
,
**
kwds
):
raise
obj_to_raise
self
.
codec_info
=
codecs
.
CodecInfo
(
raise_obj
,
raise_obj
,
name
=
self
.
codec_name
)
codec_info
=
codecs
.
CodecInfo
(
raise_obj
,
raise_obj
,
name
=
self
.
codec_name
)
_TEST_CODECS
[
self
.
codec_name
]
=
codec_info
@contextlib.contextmanager
def
assertWrapped
(
self
,
operation
,
exc_type
,
msg
):
...
...
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