summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_abstract_numbers.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_abstract_numbers.py')
-rw-r--r--Lib/test/test_abstract_numbers.py20
1 files changed, 7 insertions, 13 deletions
diff --git a/Lib/test/test_abstract_numbers.py b/Lib/test/test_abstract_numbers.py
index 925f8cf..2a396cd 100644
--- a/Lib/test/test_abstract_numbers.py
+++ b/Lib/test/test_abstract_numbers.py
@@ -1,9 +1,10 @@
"""Unit tests for numbers.py."""
import math
+import operator
import unittest
from numbers import Complex, Real, Rational, Integral
-from test import test_support
+from test import support
class TestNumbers(unittest.TestCase):
def test_int(self):
@@ -16,16 +17,6 @@ class TestNumbers(unittest.TestCase):
self.assertEqual(7, int(7).numerator)
self.assertEqual(1, int(7).denominator)
- def test_long(self):
- self.assertTrue(issubclass(long, Integral))
- self.assertTrue(issubclass(long, Complex))
-
- self.assertEqual(7, long(7).real)
- self.assertEqual(0, long(7).imag)
- self.assertEqual(7, long(7).conjugate())
- self.assertEqual(7, long(7).numerator)
- self.assertEqual(1, long(7).denominator)
-
def test_float(self):
self.assertFalse(issubclass(float, Rational))
self.assertTrue(issubclass(float, Real))
@@ -40,12 +31,15 @@ class TestNumbers(unittest.TestCase):
c1, c2 = complex(3, 2), complex(4,1)
# XXX: This is not ideal, but see the comment in math_trunc().
- self.assertRaises(AttributeError, math.trunc, c1)
+ self.assertRaises(TypeError, math.trunc, c1)
+ self.assertRaises(TypeError, operator.mod, c1, c2)
+ self.assertRaises(TypeError, divmod, c1, c2)
+ self.assertRaises(TypeError, operator.floordiv, c1, c2)
self.assertRaises(TypeError, float, c1)
self.assertRaises(TypeError, int, c1)
def test_main():
- test_support.run_unittest(TestNumbers)
+ support.run_unittest(TestNumbers)
if __name__ == "__main__":