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
e95dfc50
Unverified
Kaydet (Commit)
e95dfc50
authored
Haz 03, 2018
tarafından
Stefan Krah
Kaydeden (comit)
GitHub
Haz 03, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-33750: Reset thread-local context precision in test_round(). (#7355)
üst
867b8258
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
test_decimal.py
Lib/test/test_decimal.py
+11
-11
No files found.
Lib/test/test_decimal.py
Dosyayı görüntüle @
e95dfc50
...
@@ -4454,19 +4454,19 @@ class Coverage(unittest.TestCase):
...
@@ -4454,19 +4454,19 @@ class Coverage(unittest.TestCase):
def
test_round
(
self
):
def
test_round
(
self
):
# Python3 behavior: round() returns Decimal
# Python3 behavior: round() returns Decimal
Decimal
=
self
.
decimal
.
Decimal
Decimal
=
self
.
decimal
.
Decimal
getcontext
=
self
.
decimal
.
get
context
localcontext
=
self
.
decimal
.
local
context
c
=
getcontext
()
with
localcontext
()
as
c
:
c
.
prec
=
28
c
.
prec
=
28
self
.
assertEqual
(
str
(
Decimal
(
"9.99"
)
.
__round__
()),
"10"
)
self
.
assertEqual
(
str
(
Decimal
(
"9.99"
)
.
__round__
()),
"10"
)
self
.
assertEqual
(
str
(
Decimal
(
"9.99e-5"
)
.
__round__
()),
"0"
)
self
.
assertEqual
(
str
(
Decimal
(
"9.99e-5"
)
.
__round__
()),
"0"
)
self
.
assertEqual
(
str
(
Decimal
(
"1.23456789"
)
.
__round__
(
5
)),
"1.23457"
)
self
.
assertEqual
(
str
(
Decimal
(
"1.23456789"
)
.
__round__
(
5
)),
"1.23457"
)
self
.
assertEqual
(
str
(
Decimal
(
"1.2345"
)
.
__round__
(
10
)),
"1.2345000000"
)
self
.
assertEqual
(
str
(
Decimal
(
"1.2345"
)
.
__round__
(
10
)),
"1.2345000000"
)
self
.
assertEqual
(
str
(
Decimal
(
"1.2345"
)
.
__round__
(
-
10
)),
"0E+10"
)
self
.
assertEqual
(
str
(
Decimal
(
"1.2345"
)
.
__round__
(
-
10
)),
"0E+10"
)
self
.
assertRaises
(
TypeError
,
Decimal
(
"1.23"
)
.
__round__
,
"5"
)
self
.
assertRaises
(
TypeError
,
Decimal
(
"1.23"
)
.
__round__
,
"5"
)
self
.
assertRaises
(
TypeError
,
Decimal
(
"1.23"
)
.
__round__
,
5
,
8
)
self
.
assertRaises
(
TypeError
,
Decimal
(
"1.23"
)
.
__round__
,
5
,
8
)
def
test_create_decimal
(
self
):
def
test_create_decimal
(
self
):
c
=
self
.
decimal
.
Context
()
c
=
self
.
decimal
.
Context
()
...
@@ -5410,7 +5410,7 @@ class CWhitebox(unittest.TestCase):
...
@@ -5410,7 +5410,7 @@ class CWhitebox(unittest.TestCase):
# SSIZE_MIN
# SSIZE_MIN
x
=
(
1
,
(),
-
sys
.
maxsize
-
1
)
x
=
(
1
,
(),
-
sys
.
maxsize
-
1
)
self
.
assertEqual
(
str
(
c
.
create_decimal
(
x
)),
'-0E-10000
26
'
)
self
.
assertEqual
(
str
(
c
.
create_decimal
(
x
)),
'-0E-10000
07
'
)
self
.
assertRaises
(
InvalidOperation
,
Decimal
,
x
)
self
.
assertRaises
(
InvalidOperation
,
Decimal
,
x
)
x
=
(
1
,
(
0
,
1
,
2
),
-
sys
.
maxsize
-
1
)
x
=
(
1
,
(
0
,
1
,
2
),
-
sys
.
maxsize
-
1
)
...
...
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