Kaydet (Commit) df8a303d authored tarafından Georg Brandl's avatar Georg Brandl

Fix a few UnboundLocalErrors in test_long.

üst 8fd107f8
...@@ -536,7 +536,7 @@ class LongTest(unittest.TestCase): ...@@ -536,7 +536,7 @@ class LongTest(unittest.TestCase):
except OverflowError: except OverflowError:
self.fail("int(long(sys.maxint)) overflowed!") self.fail("int(long(sys.maxint)) overflowed!")
if not isinstance(x, int): if not isinstance(x, int):
raise TestFailed("int(long(sys.maxint)) should have returned int") self.fail("int(long(sys.maxint)) should have returned int")
x = int(hugeneg_aslong) x = int(hugeneg_aslong)
try: try:
self.assertEqual(x, hugeneg, self.assertEqual(x, hugeneg,
...@@ -544,8 +544,7 @@ class LongTest(unittest.TestCase): ...@@ -544,8 +544,7 @@ class LongTest(unittest.TestCase):
except OverflowError: except OverflowError:
self.fail("int(long(-sys.maxint-1)) overflowed!") self.fail("int(long(-sys.maxint-1)) overflowed!")
if not isinstance(x, int): if not isinstance(x, int):
raise TestFailed("int(long(-sys.maxint-1)) should have " self.fail("int(long(-sys.maxint-1)) should have returned int")
"returned int")
# but long -> int should overflow for hugepos+1 and hugeneg-1 # but long -> int should overflow for hugepos+1 and hugeneg-1
x = hugepos_aslong + 1 x = hugepos_aslong + 1
try: try:
...@@ -803,7 +802,7 @@ class LongTest(unittest.TestCase): ...@@ -803,7 +802,7 @@ class LongTest(unittest.TestCase):
self.d = d self.d = d
assert float(n) / float(d) == value assert float(n) / float(d) == value
else: else:
raise TypeError("can't deal with %r" % val) raise TypeError("can't deal with %r" % value)
def __cmp__(self, other): def __cmp__(self, other):
if not isinstance(other, Rat): if not isinstance(other, Rat):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment