[pypy-svn] pypy default: A failing test for float parsing (based ont he currently failing complex test).
alex_gaynor
commits-noreply at bitbucket.org
Tue Jan 25 05:25:12 CET 2011
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch:
Changeset: r41283:50385dbaf070
Date: 2011-01-24 23:24 -0500
http://bitbucket.org/pypy/pypy/changeset/50385dbaf070/
Log: A failing test for float parsing (based ont he currently failing
complex test).
diff --git a/pypy/objspace/std/test/test_floatobject.py b/pypy/objspace/std/test/test_floatobject.py
--- a/pypy/objspace/std/test/test_floatobject.py
+++ b/pypy/objspace/std/test/test_floatobject.py
@@ -184,7 +184,6 @@
def test_getnewargs(self):
assert 0.0 .__getnewargs__() == (0.0,)
-
def test_pow(self):
def pw(x, y):
return x ** y
@@ -391,6 +390,9 @@
# assert 5L .__eq__(3.14) is NotImplemented
# assert 3.14 .__eq__(5L) is False
+ def test_from_string(self):
+ raises(ValueError, float, "\0")
+
class AppTestFloatHex:
def w_identical(self, x, y):
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
@@ -29,7 +29,7 @@
# ignore whitespace
while i < slen and s[i] == ' ':
i += 1
-
+
if s[i] == '(' and s[slen-1] == ')':
i += 1
slen -= 1
@@ -57,7 +57,7 @@
newstop = realstop - 1
if newstop < 0:
raise ValueError
- if s[newstop] in ('j','J'):
+ if s[newstop] in ('j', 'J'):
if realstart == newstop:
imagpart = '1.0'
elif realstart == newstop-1 and s[realstart] == '+':
@@ -68,7 +68,7 @@
imagpart = s[realstart:newstop]
return '0.0', imagpart
else:
- return s[realstart:realstop],'0.0'
+ return s[realstart:realstop], '0.0'
# find sign for imaginary part
if s[i] == '-' or s[i] == '+':
More information about the Pypy-commit
mailing list