mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
* Hide a loop induction variable that was inadvertantly being picked up
by the locals() call in the context constructor. * Remove unnecessary properties for int, exp, and sign which duplicated information returned by as_tuple().
This commit is contained in:
parent
fed52963fc
commit
b91af521fd
2 changed files with 2 additions and 39 deletions
|
@ -954,34 +954,6 @@ class DecimalUsabilityTest(unittest.TestCase):
|
|||
d = Decimal("Infinity")
|
||||
self.assertEqual(d.as_tuple(), (0, (0,), 'F') )
|
||||
|
||||
def test_immutability_onpurpose(self):
|
||||
#Try to change internal objects and see if immutable.
|
||||
|
||||
d = Decimal(42)
|
||||
|
||||
#you can get the attributes...
|
||||
d.exp
|
||||
d.int
|
||||
d.sign
|
||||
|
||||
#...but not change them!
|
||||
try:
|
||||
d.exp = 20
|
||||
d.int = 3
|
||||
d.sign = 1
|
||||
except AttributeError:
|
||||
pass
|
||||
else:
|
||||
self.fail('Did not raised an error!')
|
||||
|
||||
#some new attribute
|
||||
try:
|
||||
d.newone = None
|
||||
except AttributeError:
|
||||
pass
|
||||
else:
|
||||
self.fail('Did not raised an error!')
|
||||
|
||||
def test_immutability_operations(self):
|
||||
# Do operations and check that it didn't change change internal objects.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue