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
8f43cec4
Kaydet (Commit)
8f43cec4
authored
Mar 21, 2010
tarafından
Florent Xicluna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix py3k warnings in test_decimal, using unittest.assertItemsEqual.
üst
4a0f8b89
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
17 deletions
+15
-17
test_decimal.py
Lib/test/test_decimal.py
+15
-17
No files found.
Lib/test/test_decimal.py
Dosyayı görüntüle @
8f43cec4
...
...
@@ -30,7 +30,8 @@ import pickle, copy
import
unittest
from
decimal
import
*
import
numbers
from
test.test_support
import
(
run_unittest
,
run_doctest
,
is_resource_enabled
)
from
test.test_support
import
(
run_unittest
,
run_doctest
,
is_resource_enabled
,
check_py3k_warnings
)
import
random
try
:
import
threading
...
...
@@ -201,7 +202,7 @@ class DecimalTest(unittest.TestCase):
if
skip_expected
:
raise
unittest
.
SkipTest
return
for
line
in
open
(
file
)
.
xreadlines
()
:
for
line
in
open
(
file
):
line
=
line
.
replace
(
'
\r\n
'
,
''
)
.
replace
(
'
\n
'
,
''
)
#print line
try
:
...
...
@@ -360,12 +361,9 @@ class DecimalTest(unittest.TestCase):
myexceptions
=
self
.
getexceptions
()
self
.
context
.
clear_flags
()
myexceptions
.
sort
()
theirexceptions
.
sort
()
self
.
assertEqual
(
result
,
ans
,
'Incorrect answer for '
+
s
+
' -- got '
+
result
)
self
.
assertEqual
(
myexceptions
,
theirexceptions
,
self
.
assert
Items
Equal
(
myexceptions
,
theirexceptions
,
'Incorrect flags set in '
+
s
+
' -- got '
+
str
(
myexceptions
))
return
...
...
@@ -616,12 +614,13 @@ class DecimalImplicitConstructionTest(unittest.TestCase):
(
'//'
,
'__floordiv__'
,
'__rfloordiv__'
),
(
'**'
,
'__pow__'
,
'__rpow__'
)
]
if
1
/
2
==
0
:
# testing with classic division, so add __div__
oplist
.
append
((
'/'
,
'__div__'
,
'__rdiv__'
))
else
:
# testing with -Qnew, so add __truediv__
oplist
.
append
((
'/'
,
'__truediv__'
,
'__rtruediv__'
))
with
check_py3k_warnings
():
if
1
/
2
==
0
:
# testing with classic division, so add __div__
oplist
.
append
((
'/'
,
'__div__'
,
'__rdiv__'
))
else
:
# testing with -Qnew, so add __truediv__
oplist
.
append
((
'/'
,
'__truediv__'
,
'__rtruediv__'
))
for
sym
,
lop
,
rop
in
oplist
:
setattr
(
E
,
lop
,
lambda
self
,
other
:
'str'
+
lop
+
str
(
other
))
...
...
@@ -1199,8 +1198,9 @@ class DecimalUsabilityTest(unittest.TestCase):
self
.
assertEqual
(
a
,
b
)
# with None
self
.
assertFalse
(
Decimal
(
1
)
<
None
)
self
.
assertTrue
(
Decimal
(
1
)
>
None
)
with
check_py3k_warnings
():
self
.
assertFalse
(
Decimal
(
1
)
<
None
)
self
.
assertTrue
(
Decimal
(
1
)
>
None
)
def
test_copy_and_deepcopy_methods
(
self
):
d
=
Decimal
(
'43.24'
)
...
...
@@ -2141,16 +2141,14 @@ class ContextFlags(unittest.TestCase):
for
flag
in
extra_flags
:
if
flag
not
in
expected_flags
:
expected_flags
.
append
(
flag
)
expected_flags
.
sort
()
# flags we actually got
new_flags
=
[
k
for
k
,
v
in
context
.
flags
.
items
()
if
v
]
new_flags
.
sort
()
self
.
assertEqual
(
ans
,
new_ans
,
"operation produces different answers depending on flags set: "
+
"expected
%
s, got
%
s."
%
(
ans
,
new_ans
))
self
.
assertEqual
(
new_flags
,
expected_flags
,
self
.
assert
Items
Equal
(
new_flags
,
expected_flags
,
"operation raises different flags depending on flags set: "
+
"expected
%
s, got
%
s"
%
(
expected_flags
,
new_flags
))
...
...
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