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
fd37dd46
Kaydet (Commit)
fd37dd46
authored
Mar 25, 2010
tarafından
Florent Xicluna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix test_unittest and test_warnings when running "python -Werror -m test.regrtest"
üst
8aa5a581
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
test_unittest.py
Lib/test/test_unittest.py
+6
-11
test_warnings.py
Lib/test/test_warnings.py
+5
-0
No files found.
Lib/test/test_unittest.py
Dosyayı görüntüle @
fd37dd46
...
@@ -16,7 +16,6 @@ import types
...
@@ -16,7 +16,6 @@ import types
from
copy
import
deepcopy
from
copy
import
deepcopy
from
cStringIO
import
StringIO
from
cStringIO
import
StringIO
import
pickle
import
pickle
import
warnings
### Support code
### Support code
...
@@ -2136,12 +2135,11 @@ OldResult = type('OldResult', (object,), classDict)
...
@@ -2136,12 +2135,11 @@ OldResult = type('OldResult', (object,), classDict)
class
Test_OldTestResult
(
unittest
.
TestCase
):
class
Test_OldTestResult
(
unittest
.
TestCase
):
def
assertOldResultWarning
(
self
,
test
,
failures
):
def
assertOldResultWarning
(
self
,
test
,
failures
):
with
warnings
.
catch_warnings
(
record
=
True
)
as
log
:
with
test_support
.
check_warnings
((
"TestResult has no add.+ method,"
,
RuntimeWarning
)):
result
=
OldResult
()
result
=
OldResult
()
test
.
run
(
result
)
test
.
run
(
result
)
self
.
assertEqual
(
len
(
result
.
failures
),
failures
)
self
.
assertEqual
(
len
(
result
.
failures
),
failures
)
warning
,
=
log
self
.
assertIs
(
warning
.
category
,
RuntimeWarning
)
def
testOldTestResult
(
self
):
def
testOldTestResult
(
self
):
class
Test
(
unittest
.
TestCase
):
class
Test
(
unittest
.
TestCase
):
...
@@ -2702,8 +2700,7 @@ class Test_TestCase(TestCase, TestEquality, TestHashing):
...
@@ -2702,8 +2700,7 @@ class Test_TestCase(TestCase, TestEquality, TestHashing):
with
self
.
assertRaises
(
self
.
failureException
):
with
self
.
assertRaises
(
self
.
failureException
):
self
.
assertDictContainsSubset
({
'a'
:
1
,
'c'
:
1
},
{
'a'
:
1
})
self
.
assertDictContainsSubset
({
'a'
:
1
,
'c'
:
1
},
{
'a'
:
1
})
with
warnings
.
catch_warnings
(
record
=
True
):
with
test_support
.
check_warnings
((
""
,
UnicodeWarning
)):
# silence the UnicodeWarning
one
=
''
.
join
(
chr
(
i
)
for
i
in
range
(
255
))
one
=
''
.
join
(
chr
(
i
)
for
i
in
range
(
255
))
# this used to cause a UnicodeDecodeError constructing the failure msg
# this used to cause a UnicodeDecodeError constructing the failure msg
with
self
.
assertRaises
(
self
.
failureException
):
with
self
.
assertRaises
(
self
.
failureException
):
...
@@ -3348,11 +3345,9 @@ class TestLongMessage(TestCase):
...
@@ -3348,11 +3345,9 @@ class TestLongMessage(TestCase):
self
.
testableTrue
.
_formatMessage
(
object
(),
'foo'
)
self
.
testableTrue
.
_formatMessage
(
object
(),
'foo'
)
def
test_formatMessage_unicode_error
(
self
):
def
test_formatMessage_unicode_error
(
self
):
with
warnings
.
catch_warnings
(
record
=
True
):
one
=
''
.
join
(
chr
(
i
)
for
i
in
range
(
255
))
# This causes a UnicodeWarning due to its craziness
# this used to cause a UnicodeDecodeError constructing msg
one
=
''
.
join
(
chr
(
i
)
for
i
in
range
(
255
))
self
.
testableTrue
.
_formatMessage
(
one
,
u'
\uFFFD
'
)
# this used to cause a UnicodeDecodeError constructing msg
self
.
testableTrue
.
_formatMessage
(
one
,
u'
\uFFFD
'
)
def
assertMessages
(
self
,
methodName
,
args
,
errors
):
def
assertMessages
(
self
,
methodName
,
args
,
errors
):
def
getMethod
(
i
):
def
getMethod
(
i
):
...
...
Lib/test/test_warnings.py
Dosyayı görüntüle @
fd37dd46
...
@@ -27,11 +27,15 @@ def warnings_state(module):
...
@@ -27,11 +27,15 @@ def warnings_state(module):
except
NameError
:
except
NameError
:
pass
pass
original_warnings
=
warning_tests
.
warnings
original_warnings
=
warning_tests
.
warnings
original_filters
=
module
.
filters
try
:
try
:
module
.
filters
=
original_filters
[:]
module
.
simplefilter
(
"once"
)
warning_tests
.
warnings
=
module
warning_tests
.
warnings
=
module
yield
yield
finally
:
finally
:
warning_tests
.
warnings
=
original_warnings
warning_tests
.
warnings
=
original_warnings
module
.
filters
=
original_filters
class
BaseTest
(
unittest
.
TestCase
):
class
BaseTest
(
unittest
.
TestCase
):
...
@@ -194,6 +198,7 @@ class WarnTests(unittest.TestCase):
...
@@ -194,6 +198,7 @@ class WarnTests(unittest.TestCase):
def
test_message
(
self
):
def
test_message
(
self
):
with
original_warnings
.
catch_warnings
(
record
=
True
,
with
original_warnings
.
catch_warnings
(
record
=
True
,
module
=
self
.
module
)
as
w
:
module
=
self
.
module
)
as
w
:
self
.
module
.
simplefilter
(
"once"
)
for
i
in
range
(
4
):
for
i
in
range
(
4
):
text
=
'multi
%
d'
%
i
# Different text on each call.
text
=
'multi
%
d'
%
i
# Different text on each call.
self
.
module
.
warn
(
text
)
self
.
module
.
warn
(
text
)
...
...
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