mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Remove the old decimal context management tests from test_contextlib (guess who didn't run the test suite before committing...)
This commit is contained in:
parent
8b6999b4c5
commit
db38588a25
1 changed files with 0 additions and 26 deletions
|
@ -330,32 +330,6 @@ class LockContextTestCase(unittest.TestCase):
|
||||||
return True
|
return True
|
||||||
self.boilerPlate(lock, locked)
|
self.boilerPlate(lock, locked)
|
||||||
|
|
||||||
class DecimalContextTestCase(unittest.TestCase):
|
|
||||||
|
|
||||||
# XXX Somebody should write more thorough tests for this
|
|
||||||
|
|
||||||
def testBasic(self):
|
|
||||||
ctx = decimal.getcontext()
|
|
||||||
orig_context = ctx.copy()
|
|
||||||
try:
|
|
||||||
ctx.prec = save_prec = decimal.ExtendedContext.prec + 5
|
|
||||||
with decimal.ExtendedContext.get_manager():
|
|
||||||
self.assertEqual(decimal.getcontext().prec,
|
|
||||||
decimal.ExtendedContext.prec)
|
|
||||||
self.assertEqual(decimal.getcontext().prec, save_prec)
|
|
||||||
try:
|
|
||||||
with decimal.ExtendedContext.get_manager():
|
|
||||||
self.assertEqual(decimal.getcontext().prec,
|
|
||||||
decimal.ExtendedContext.prec)
|
|
||||||
1/0
|
|
||||||
except ZeroDivisionError:
|
|
||||||
self.assertEqual(decimal.getcontext().prec, save_prec)
|
|
||||||
else:
|
|
||||||
self.fail("Didn't raise ZeroDivisionError")
|
|
||||||
finally:
|
|
||||||
decimal.setcontext(orig_context)
|
|
||||||
|
|
||||||
|
|
||||||
# This is needed to make the test actually run under regrtest.py!
|
# This is needed to make the test actually run under regrtest.py!
|
||||||
def test_main():
|
def test_main():
|
||||||
run_suite(
|
run_suite(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue