[pypy-svn] r23258 - in pypy/dist/pypy/objspace/std: . test

stephan at codespeak.net stephan at codespeak.net
Sun Feb 12 15:33:49 CET 2006


Author: stephan
Date: Sun Feb 12 15:33:47 2006
New Revision: 23258

Modified:
   pypy/dist/pypy/objspace/std/complexobject.py
   pypy/dist/pypy/objspace/std/test/test_complexobject.py
Log:
complexobject/complextype now passes all tests.


Modified: pypy/dist/pypy/objspace/std/complexobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/complexobject.py	(original)
+++ pypy/dist/pypy/objspace/std/complexobject.py	Sun Feb 12 15:33:47 2006
@@ -233,6 +233,13 @@
     return space.newbool((w_complex1.realval != w_complex2.realval) or 
             (w_complex1.imagval != w_complex2.imagval))
 
+def lt__Complex_Complex(space, w_complex1, w_complex2):
+    raise OperationError(space.w_TypeError, space.wrap('cannot compare complex numbers using <, <=, >, >='))
+
+gt__Complex_Complex = lt__Complex_Complex
+ge__Complex_Complex = lt__Complex_Complex
+le__Complex_Complex = lt__Complex_Complex
+
 def nonzero__Complex(space, w_complex):
     return space.newbool(w_complex.realval or w_complex.imagval)
 

Modified: pypy/dist/pypy/objspace/std/test/test_complexobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_complexobject.py	(original)
+++ pypy/dist/pypy/objspace/std/test/test_complexobject.py	Sun Feb 12 15:33:47 2006
@@ -108,7 +108,7 @@
         h = self.helper
         h.raises(OverflowError, complex.__coerce__, 1+1j, 1L<<10000)
 
-    def x_test_richcompare(self):
+    def test_richcompare(self):
         h = self.helper
         h.raises(OverflowError, complex.__eq__, 1+1j, 1L<<10000)
         h.assertEqual(complex.__lt__(1+1j, None), NotImplemented)
@@ -313,23 +313,25 @@
         h = self.helper
         h.assertEqual(-(1+6j), -1-6j)
 
-    def x_test_file(self):
+    def test_file(self):
         h = self.helper
         import os
+        import tempfile
         a = 3.33+4.43j
         b = 5.1+2.3j
 
         fo = None
         try:
-            fo = open(test_support.TESTFN, "wb")
+            pth = tempfile.mktemp()
+            fo = open(pth,"wb")
             print >>fo, a, b
             fo.close()
-            fo = open(test_support.TESTFN, "rb")
+            fo = open(pth, "rb")
             h.assertEqual(fo.read(), "%s %s\n" % (a, b))
         finally:
             if (fo is not None) and (not fo.closed):
                 fo.close()
             try:
-                os.remove(test_support.TESTFN)
+                os.remove(pth)
             except (OSError, IOError):
                 pass



More information about the Pypy-commit mailing list