diff options
Diffstat (limited to 'Lib/test/test_augassign.py')
-rw-r--r-- | Lib/test/test_augassign.py | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/Lib/test/test_augassign.py b/Lib/test/test_augassign.py index 059e8b74c90..9a59c58ec06 100644 --- a/Lib/test/test_augassign.py +++ b/Lib/test/test_augassign.py @@ -1,6 +1,6 @@ # Augmented assignment test. -from test.test_support import run_unittest, check_py3k_warnings +from test.support import run_unittest import unittest @@ -17,12 +17,7 @@ class AugAssignTest(unittest.TestCase): x |= 5 x ^= 1 x /= 2 - if 1/2 == 0: - # classic division - self.assertEqual(x, 3) - else: - # new-style division (with -Qnew) - self.assertEqual(x, 3.0) + self.assertEqual(x, 3.0) def test_with_unpacking(self): self.assertRaises(SyntaxError, compile, "x, b += 3", "<test>", "exec") @@ -39,10 +34,7 @@ class AugAssignTest(unittest.TestCase): x[0] |= 5 x[0] ^= 1 x[0] /= 2 - if 1/2 == 0: - self.assertEqual(x[0], 3) - else: - self.assertEqual(x[0], 3.0) + self.assertEqual(x[0], 3.0) def testInDict(self): x = {0: 2} @@ -56,10 +48,7 @@ class AugAssignTest(unittest.TestCase): x[0] |= 5 x[0] ^= 1 x[0] /= 2 - if 1/2 == 0: - self.assertEqual(x[0], 3) - else: - self.assertEqual(x[0], 3.0) + self.assertEqual(x[0], 3.0) def testSequences(self): x = [1,2] @@ -168,6 +157,9 @@ class AugAssignTest(unittest.TestCase): def __truediv__(self, val): output.append("__truediv__ called") return self + def __rtruediv__(self, val): + output.append("__rtruediv__ called") + return self def __itruediv__(self, val): output.append("__itruediv__ called") return self @@ -241,16 +233,9 @@ class AugAssignTest(unittest.TestCase): 1 * x x *= 1 - if 1/2 == 0: - x / 1 - 1 / x - x /= 1 - else: - # True division is in effect, so "/" doesn't map to __div__ etc; - # but the canned expected-output file requires that those get called. - x.__div__(1) - x.__rdiv__(1) - x.__idiv__(1) + x / 1 + 1 / x + x /= 1 x // 1 1 // x @@ -294,9 +279,9 @@ __isub__ called __mul__ called __rmul__ called __imul__ called -__div__ called -__rdiv__ called -__idiv__ called +__truediv__ called +__rtruediv__ called +__itruediv__ called __floordiv__ called __rfloordiv__ called __ifloordiv__ called @@ -324,8 +309,7 @@ __ilshift__ called '''.splitlines()) def test_main(): - with check_py3k_warnings(("classic int division", DeprecationWarning)): - run_unittest(AugAssignTest) + run_unittest(AugAssignTest) if __name__ == '__main__': test_main() |