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
db1bd5c2
Kaydet (Commit)
db1bd5c2
authored
Ara 23, 1999
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Revise tests to support str(<long int object>) not appending "L".
üst
b06007a3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
15 deletions
+21
-15
test_b2.py
Lib/test/test_b2.py
+1
-1
test_long.py
Lib/test/test_long.py
+8
-2
test_pow.py
Lib/test/test_pow.py
+12
-12
No files found.
Lib/test/test_b2.py
Dosyayı görüntüle @
db1bd5c2
...
...
@@ -209,7 +209,7 @@ if sys.spam != 1: raise TestFailed, 'setattr(sys, \'spam\', 1)'
print
'str'
if
str
(
''
)
<>
''
:
raise
TestFailed
,
'str(
\'\'
)'
if
str
(
0
)
<>
'0'
:
raise
TestFailed
,
'str(0)'
if
str
(
0L
)
<>
'0
L
'
:
raise
TestFailed
,
'str(0L)'
if
str
(
0L
)
<>
'0'
:
raise
TestFailed
,
'str(0L)'
if
str
(())
<>
'()'
:
raise
TestFailed
,
'str(())'
if
str
([])
<>
'[]'
:
raise
TestFailed
,
'str([])'
if
str
({})
<>
'{}'
:
raise
TestFailed
,
'str({})'
...
...
Lib/test/test_long.py
Dosyayı görüntüle @
db1bd5c2
...
...
@@ -159,7 +159,7 @@ def test_bitop_identities(maxdigits=MAXDIGITS):
test_bitop_identities_2
(
x
,
y
)
test_bitop_identities_3
(
x
,
y
,
getran
((
lenx
+
leny
)
/
2
))
# -------------------------------------------------
----- hex oct
str atol
# -------------------------------------------------
hex oct repr
str atol
def
slow_format
(
x
,
base
):
if
(
x
,
base
)
==
(
0
,
8
):
...
...
@@ -181,12 +181,18 @@ def slow_format(x, base):
def
test_format_1
(
x
):
from
string
import
atol
for
base
,
mapper
in
(
8
,
oct
),
(
10
,
st
r
),
(
16
,
hex
):
for
base
,
mapper
in
(
8
,
oct
),
(
10
,
rep
r
),
(
16
,
hex
):
got
=
mapper
(
x
)
expected
=
slow_format
(
x
,
base
)
check
(
got
==
expected
,
mapper
.
__name__
,
"returned"
,
got
,
"but expected"
,
expected
,
"for"
,
x
)
check
(
atol
(
got
,
0
)
==
x
,
'atol("
%
s", 0) !='
%
got
,
x
)
# str() has to be checked a little differently since there's no
# trailing "L"
got
=
str
(
x
)
expected
=
slow_format
(
x
,
10
)[:
-
1
]
check
(
got
==
expected
,
mapper
.
__name__
,
"returned"
,
got
,
"but expected"
,
expected
,
"for"
,
x
)
def
test_format
(
maxdigits
=
MAXDIGITS
):
print
"long str/hex/oct/atol"
...
...
Lib/test/test_pow.py
Dosyayı görüntüle @
db1bd5c2
...
...
@@ -56,20 +56,20 @@ powtest(float)
# Other tests-- not very systematic
print
'The number in both columns should match.'
print
pow
(
3
,
3
)
%
8
,
pow
(
3
,
3
,
8
)
print
pow
(
3
,
3
)
%
-
8
,
pow
(
3
,
3
,
-
8
)
print
pow
(
3
,
2
)
%
-
2
,
pow
(
3
,
2
,
-
2
)
print
pow
(
-
3
,
3
)
%
8
,
pow
(
-
3
,
3
,
8
)
print
pow
(
-
3
,
3
)
%
-
8
,
pow
(
-
3
,
3
,
-
8
)
print
pow
(
5
,
2
)
%
-
8
,
pow
(
5
,
2
,
-
8
)
print
`pow(3,3) % 8`
,
`pow(3,3,8)`
print
`pow(3,3) % -8`
,
`pow(3,3,-8)`
print
`pow(3,2) % -2`
,
`pow(3,2,-2)`
print
`pow(-3,3) % 8`
,
`pow(-3,3,8)`
print
`pow(-3,3) % -8`
,
`pow(-3,3,-8)`
print
`pow(5,2) % -8`
,
`pow(5,2,-8)`
print
print
pow
(
3L
,
3L
)
%
8
,
pow
(
3L
,
3L
,
8
)
print
pow
(
3L
,
3L
)
%
-
8
,
pow
(
3L
,
3L
,
-
8
)
print
pow
(
3L
,
2
)
%
-
2
,
pow
(
3L
,
2
,
-
2
)
print
pow
(
-
3L
,
3L
)
%
8
,
pow
(
-
3L
,
3L
,
8
)
print
pow
(
-
3L
,
3L
)
%
-
8
,
pow
(
-
3L
,
3L
,
-
8
)
print
pow
(
5L
,
2
)
%
-
8
,
pow
(
5L
,
2
,
-
8
)
print
`pow(3L,3L) % 8`
,
`pow(3L,3L,8)`
print
`pow(3L,3L) % -8`
,
`pow(3L,3L,-8)`
print
`pow(3L,2) % -2`
,
`pow(3L,2,-2)`
print
`pow(-3L,3L) % 8`
,
`pow(-3L,3L,8)`
print
`pow(-3L,3L) % -8`
,
`pow(-3L,3L,-8)`
print
`pow(5L,2) % -8`
,
`pow(5L,2,-8)`
print
print
pow
(
3.0
,
3.0
)
%
8
,
pow
(
3.0
,
3.0
,
8
)
...
...
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