Whitespace.

This commit is contained in:
Stefan Krah 2012-04-02 15:10:36 +02:00
parent aae5c3a8ab
commit 38548ad006
1 changed files with 49 additions and 49 deletions

View File

@ -59,63 +59,63 @@ sys.modules['decimal'] = orig_sys_decimal
############ RunFirst ############ ############ RunFirst ############
class RunFirst(unittest.TestCase): class RunFirst(unittest.TestCase):
def setUp(self): def setUp(self):
self.save_default = self.decimal.DefaultContext.copy() self.save_default = self.decimal.DefaultContext.copy()
def tearDown(self): def tearDown(self):
DefaultContext = self.decimal.DefaultContext DefaultContext = self.decimal.DefaultContext
DefaultContext.prec = self.save_default.prec DefaultContext.prec = self.save_default.prec
DefaultContext.rounding = self.save_default.rounding DefaultContext.rounding = self.save_default.rounding
DefaultContext.Emax = self.save_default.Emax DefaultContext.Emax = self.save_default.Emax
DefaultContext.Emin = self.save_default.Emin DefaultContext.Emin = self.save_default.Emin
DefaultContext.capitals = self.save_default.capitals DefaultContext.capitals = self.save_default.capitals
DefaultContext.clamp = self.save_default.clamp DefaultContext.clamp = self.save_default.clamp
DefaultContext.flags = self.save_default.flags DefaultContext.flags = self.save_default.flags
DefaultContext.traps = self.save_default.traps DefaultContext.traps = self.save_default.traps
self.decimal.setcontext(self.decimal.DefaultContext) self.decimal.setcontext(self.decimal.DefaultContext)
def test_00default_context(self): def test_00default_context(self):
# The test depends on the fact that getcontext() is called # The test depends on the fact that getcontext() is called
# for the first time. # for the first time.
DefaultContext = self.decimal.DefaultContext DefaultContext = self.decimal.DefaultContext
ROUND_05UP = self.decimal.ROUND_05UP ROUND_05UP = self.decimal.ROUND_05UP
Clamped = self.decimal.Clamped Clamped = self.decimal.Clamped
InvalidOperation = self.decimal.InvalidOperation InvalidOperation = self.decimal.InvalidOperation
DefaultContext.prec = 5001 DefaultContext.prec = 5001
DefaultContext.rounding = ROUND_05UP DefaultContext.rounding = ROUND_05UP
DefaultContext.Emax = 10025 DefaultContext.Emax = 10025
DefaultContext.Emin = -10025 DefaultContext.Emin = -10025
DefaultContext.capitals = 0 DefaultContext.capitals = 0
DefaultContext.clamp = 1 DefaultContext.clamp = 1
DefaultContext.flags[InvalidOperation] = True DefaultContext.flags[InvalidOperation] = True
DefaultContext.clear_traps() DefaultContext.clear_traps()
DefaultContext.traps[Clamped] = True DefaultContext.traps[Clamped] = True
# implicit initialization on first access # implicit initialization on first access
c = self.decimal.getcontext() c = self.decimal.getcontext()
self.assertEqual(c.prec, 5001) self.assertEqual(c.prec, 5001)
self.assertEqual(c.rounding, ROUND_05UP) self.assertEqual(c.rounding, ROUND_05UP)
self.assertEqual(c.Emax, 10025) self.assertEqual(c.Emax, 10025)
self.assertEqual(c.Emin, -10025) self.assertEqual(c.Emin, -10025)
self.assertEqual(c.capitals, 0) self.assertEqual(c.capitals, 0)
self.assertEqual(c.clamp, 1) self.assertEqual(c.clamp, 1)
for k in c.flags: for k in c.flags:
self.assertFalse(c.flags[k]) self.assertFalse(c.flags[k])
for k in c.traps: for k in c.traps:
if k is Clamped: if k is Clamped:
self.assertTrue(c.traps[k]) self.assertTrue(c.traps[k])
else: else:
self.assertFalse(c.traps[k]) self.assertFalse(c.traps[k])
# explicit initialization # explicit initialization
self.decimal.setcontext(DefaultContext) self.decimal.setcontext(DefaultContext)
c = self.decimal.getcontext() c = self.decimal.getcontext()
for k in c.flags: for k in c.flags:
self.assertFalse(c.flags[k]) self.assertFalse(c.flags[k])
class CRunFirst(RunFirst): class CRunFirst(RunFirst):
decimal = C decimal = C