diff options
author | Guido van Rossum <guido@python.org> | 2007-08-03 20:40:44 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-08-03 20:40:44 (GMT) |
commit | 9648d62fd58d9ae9356ab717e3d594a61cb4782a (patch) | |
tree | 857aad02a1527689e79b0d7949058a29e27b7407 /Lib | |
parent | 5accbdb8123a814d9a602e7bb640ad7f0e953f54 (diff) | |
download | cpython-9648d62fd58d9ae9356ab717e3d594a61cb4782a.zip cpython-9648d62fd58d9ae9356ab717e3d594a61cb4782a.tar.gz cpython-9648d62fd58d9ae9356ab717e3d594a61cb4782a.tar.bz2 |
Make test_complex pass again now that floordiv and mod are illegal.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_complex.py | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/Lib/test/test_complex.py b/Lib/test/test_complex.py index c0ec50d..8299ca1 100644 --- a/Lib/test/test_complex.py +++ b/Lib/test/test_complex.py @@ -89,8 +89,8 @@ class ComplexTest(unittest.TestCase): self.assertRaises(ZeroDivisionError, complex.__truediv__, 1+1j, 0+0j) def test_floordiv(self): - self.assertAlmostEqual(complex.__floordiv__(3+0j, 1.5+0j), 2) - self.assertRaises(ZeroDivisionError, complex.__floordiv__, 3+0j, 0+0j) + self.assertRaises(TypeError, complex.__floordiv__, 3+0j, 1.5+0j) + self.assertRaises(TypeError, complex.__floordiv__, 3+0j, 0+0j) def test_richcompare(self): self.assertRaises(OverflowError, complex.__eq__, 1+1j, 1<<10000) @@ -105,18 +105,13 @@ class ComplexTest(unittest.TestCase): self.assertRaises(TypeError, complex.__ge__, 1+1j, 2+2j) def test_mod(self): - self.assertRaises(ZeroDivisionError, (1+1j).__mod__, 0+0j) - - a = 3.33+4.43j - try: - a % 0 - except ZeroDivisionError: - pass - else: - self.fail("modulo parama can't be 0") + # % is no longer supported on complex numbers + self.assertRaises(TypeError, (1+1j).__mod__, 0+0j) + self.assertRaises(TypeError, lambda: (3.33+4.43j) % 0) def test_divmod(self): - self.assertRaises(ZeroDivisionError, divmod, 1+1j, 0+0j) + self.assertRaises(TypeError, divmod, 1+1j, 1+0j) + self.assertRaises(TypeError, divmod, 1+1j, 0+0j) def test_pow(self): self.assertAlmostEqual(pow(1+1j, 0+0j), 1.0) |