[pypy-commit] pypy default: test/fix parsing of spaces between nums in complex constructor

bdkearns noreply at buildbot.pypy.org
Thu May 8 23:37:00 CEST 2014


Author: Brian Kearns <bdkearns at gmail.com>
Branch: 
Changeset: r71421:84388c3ff677
Date: 2014-05-08 17:14 -0400
http://bitbucket.org/pypy/pypy/changeset/84388c3ff677/

Log:	test/fix parsing of spaces between nums in complex constructor

diff --git a/pypy/objspace/std/complextype.py b/pypy/objspace/std/complextype.py
--- a/pypy/objspace/std/complextype.py
+++ b/pypy/objspace/std/complextype.py
@@ -50,10 +50,6 @@
 
     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
diff --git a/pypy/objspace/std/test/test_complexobject.py b/pypy/objspace/std/test/test_complexobject.py
--- a/pypy/objspace/std/test/test_complexobject.py
+++ b/pypy/objspace/std/test/test_complexobject.py
@@ -82,9 +82,7 @@
 
 
 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."""
@@ -383,7 +381,6 @@
         #
         assert cmath.polar(1) == (1.0, 0.0)
         raises(TypeError, "cmath.polar(Obj(1))")
-        
 
     def test_hash(self):
         for x in xrange(-30, 30):
@@ -403,7 +400,9 @@
         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


More information about the pypy-commit mailing list