Commits

Brian Kearns committed 84388c3

test/fix parsing of spaces between nums in complex constructor

  • Participants
  • Parent commits e6b55fa

Comments (0)

Files changed (2)

pypy/objspace/std/complextype.py

 
     realstop = i
 
-    # ignore whitespace
-    while i < slen and s[i] == ' ':
-        i += 1
-
     # return appropriate strings is only one number is there
     if i >= slen:
         newstop = realstop - 1

pypy/objspace/std/test/test_complexobject.py

 
 
 class AppTestAppComplexTest:
-    spaceconfig = {
-        "usemodules": ["binascii", "rctime"]
-    }
+    spaceconfig = {"usemodules": ["binascii", "rctime"]}
 
     def w_check_div(self, x, y):
         """Compute complex z=x*y, and check that z/x==y and z/y==x."""
         #
         assert cmath.polar(1) == (1.0, 0.0)
         raises(TypeError, "cmath.polar(Obj(1))")
-        
 
     def test_hash(self):
         for x in xrange(-30, 30):
         assert j(100 + 0j) == 100 + 0j
         assert isinstance(j(100), j)
         assert j(100L + 0j) == 100 + 0j
-        assert j("100 + 0j") == 100 + 0j
+        assert j("100+0j") == 100 + 0j
+        exc = raises(ValueError, j, "100 + 0j")
+        assert str(exc.value) == "complex() arg is a malformed string"
         x = j(1+0j)
         x.foo = 42
         assert x.foo == 42