[pypy-commit] pypy default: add test for invalid float argument and for nan

kostialopuhin noreply at buildbot.pypy.org
Fri Oct 26 10:50:13 CEST 2012


Author: Konstantin Lopuhin <kostia.lopuhin at gmail.com>
Branch: 
Changeset: r58429:cb3d6f20e44c
Date: 2012-07-21 00:05 +0400
http://bitbucket.org/pypy/pypy/changeset/cb3d6f20e44c/

Log:	add test for invalid float argument and for nan

diff --git a/pypy/objspace/std/test/test_bytearrayobject.py b/pypy/objspace/std/test/test_bytearrayobject.py
--- a/pypy/objspace/std/test/test_bytearrayobject.py
+++ b/pypy/objspace/std/test/test_bytearrayobject.py
@@ -443,6 +443,9 @@
         assert float(bytearray(b'10.4')) == 10.4
         assert float(bytearray('-1.7e-1')) == -1.7e-1
         assert float(bytearray(u'.9e10', 'utf-8')) == .9e10
+        import math
+        assert math.isnan(float(bytearray('nan')))
+        raises(ValueError, float, bytearray('not_a_number'))
 
     def test_reduce(self):
         assert bytearray('caf\xe9').__reduce__() == (


More information about the pypy-commit mailing list