]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport:
authorWalter Dörwald <walter@livinglogic.de>
Tue, 5 Aug 2003 16:01:08 +0000 (16:01 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Tue, 5 Aug 2003 16:01:08 +0000 (16:01 +0000)
* Check both __div__ and __truediv__ in division tests.
  (From SF patch #543867)
* Remove useless import.

Lib/test/test_complex.py

index 0e844d826a6530752a9d5b33aba6bbab82ff17a4..478bd1038e0c7b372e0917d583dcdfb86e2ce922 100644 (file)
@@ -55,9 +55,21 @@ class ComplexTest(unittest.TestCase):
         if x != 0:
             q = z / x
             self.assertClose(q, y)
+            q = z.__div__(x)
+            self.assertClose(q, y)
+            q = z.__truediv__(x)
+            self.assertClose(q, y)
+            q2 = z.__floordiv__(x)
+            self.assertClose(q2, math.floor(q.real)+0j)
         if y != 0:
             q = z / y
             self.assertClose(q, x)
+            q = z.__div__(y)
+            self.assertClose(q, x)
+            q = z.__truediv__(y)
+            self.assertClose(q, x)
+            q2 = z.__floordiv__(y)
+            self.assertClose(q2, math.floor(q.real)+0j)
 
     def test_div(self):
         simple_real = [float(i) for i in xrange(-5, 6)]