mirror of
https://github.com/python/cpython.git
synced 2025-10-01 21:02:15 +00:00
bpo-33750: Reset thread-local context precision in test_round(). (GH-7355) (#7357)
(cherry picked from commit e95dfc5006
)
Co-authored-by: Stefan Krah <skrah@bytereef.org>
This commit is contained in:
parent
ad4c7954df
commit
bdab3ea8b9
1 changed files with 11 additions and 11 deletions
|
@ -4454,9 +4454,9 @@ 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.getcontext
|
localcontext = self.decimal.localcontext
|
||||||
|
|
||||||
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")
|
||||||
|
@ -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-1000026')
|
self.assertEqual(str(c.create_decimal(x)), '-0E-1000007')
|
||||||
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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue