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
ee340e50
Kaydet (Commit)
ee340e50
authored
May 02, 2008
tarafından
Facundo Batista
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed some test structures. Thanks Mark Dickinson.
üst
7c5c8e68
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
21 deletions
+10
-21
decimal.py
Lib/decimal.py
+1
-5
test_decimal.py
Lib/test/test_decimal.py
+9
-16
No files found.
Lib/decimal.py
Dosyayı görüntüle @
ee340e50
...
...
@@ -477,11 +477,7 @@ def localcontext(ctx=None):
# General Decimal Arithmetic Specification
return +s # Convert result to normal context
"""
# The string below can't be included in the docstring until Python 2.6
# as the doctest module doesn't understand __future__ statements
"""
>>> from __future__ import with_statement
>>> setcontext(DefaultContext)
>>> print getcontext().prec
28
>>> with localcontext():
...
...
Lib/test/test_decimal.py
Dosyayı görüntüle @
ee340e50
...
...
@@ -46,10 +46,12 @@ Signals = getcontext().flags.keys()
def
init
():
global
ORIGINAL_CONTEXT
ORIGINAL_CONTEXT
=
getcontext
()
.
copy
()
DefaultContext
.
prec
=
9
DefaultContext
.
rounding
=
ROUND_HALF_EVEN
DefaultContext
.
traps
=
dict
.
fromkeys
(
Signals
,
0
)
setcontext
(
DefaultContext
)
DefaultTestContext
=
Context
(
prec
=
9
,
rounding
=
ROUND_HALF_EVEN
,
traps
=
dict
.
fromkeys
(
Signals
,
0
)
)
setcontext
(
DefaultTestContext
)
TESTDATADIR
=
'decimaltestdata'
if
__name__
==
'__main__'
:
...
...
@@ -179,8 +181,6 @@ class DecimalTest(unittest.TestCase):
"""
def
setUp
(
self
):
self
.
context
=
Context
()
for
key
in
DefaultContext
.
traps
.
keys
():
DefaultContext
.
traps
[
key
]
=
1
self
.
ignore_list
=
[
'#'
]
# Basically, a # means return NaN InvalidOperation.
# Different from a sNaN in trim
...
...
@@ -191,13 +191,6 @@ class DecimalTest(unittest.TestCase):
'minexponent'
:
self
.
change_min_exponent
,
'clamp'
:
self
.
change_clamp
}
def
tearDown
(
self
):
"""Cleaning up enviroment."""
# leaving context in original state
for
key
in
DefaultContext
.
traps
.
keys
():
DefaultContext
.
traps
[
key
]
=
0
return
def
eval_file
(
self
,
file
):
global
skip_expected
if
skip_expected
:
...
...
@@ -959,8 +952,8 @@ def thfunc1(cls):
test2
=
d1
/
d3
cls
.
finish1
.
set
()
cls
.
assertEqual
(
test1
,
Decimal
(
'0.333333333'
))
cls
.
assertEqual
(
test2
,
Decimal
(
'0.333333333'
))
cls
.
assertEqual
(
test1
,
Decimal
(
'0.333333333
3333333333333333333
'
))
cls
.
assertEqual
(
test2
,
Decimal
(
'0.333333333
3333333333333333333
'
))
return
def
thfunc2
(
cls
):
...
...
@@ -973,7 +966,7 @@ def thfunc2(cls):
cls
.
synchro
.
set
()
cls
.
finish2
.
set
()
cls
.
assertEqual
(
test1
,
Decimal
(
'0.333333333'
))
cls
.
assertEqual
(
test1
,
Decimal
(
'0.333333333
3333333333333333333
'
))
cls
.
assertEqual
(
test2
,
Decimal
(
'0.333333333333333333'
))
return
...
...
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