[pypy-svn] pypy psycopg2compatibility: The test before was a bit silly.

ademan commits-noreply at bitbucket.org
Fri Jan 14 03:34:45 CET 2011


Author: Daniel Roberts <Ademan555 at gmail.com>
Branch: psycopg2compatibility
Changeset: r40653:95d60280aadf
Date: 2011-01-13 16:05 -0800
http://bitbucket.org/pypy/pypy/changeset/95d60280aadf/

Log:	The test before was a bit silly.

diff --git a/pypy/module/cpyext/test/test_floatobject.py b/pypy/module/cpyext/test/test_floatobject.py
--- a/pypy/module/cpyext/test/test_floatobject.py
+++ b/pypy/module/cpyext/test/test_floatobject.py
@@ -23,18 +23,16 @@
                           space.wrap(42.5))
 
     def test_from_string(self, space, api):
-        def test_number(n, expectfail=False):
-            np = lltype.nullptr(rffi.CCHARPP.TO)
-            w_n = space.wrap(n)
-            f = api.PyFloat_FromString(w_n, np)
-            if expectfail:
-                assert f == None
-            else:
-                assert space.eq_w(f, space.wrap(n))
+        np = lltype.nullptr(rffi.CCHARPP.TO)
+
+        def test_number(n):
+            f = api.PyFloat_FromString(space.wrap(str(n)), np)
+            assert space.eq_w(f, space.wrap(n))
 
         test_number(0.0)
         test_number(42.0)
-        test_number("abcd", True)
+
+        self.raises(space, api, ValueError, api.PyFloat_FromString, space.wrap("abcd"), np)
 
 class AppTestFloatObject(AppTestCpythonExtensionBase):
     def test_fromstring(self):


More information about the Pypy-commit mailing list