[pypy-commit] lang-smalltalk default: (cfbolz, timfel) also test inf and nan

timfel noreply at buildbot.pypy.org
Wed Mar 13 17:47:39 CET 2013


Author: Tim Felgentreff <timfelgentreff at gmail.com>
Branch: 
Changeset: r174:a82377298595
Date: 2013-03-13 17:11 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/a82377298595/

Log:	(cfbolz, timfel) also test inf and nan

diff --git a/spyvm/test/test_model.py b/spyvm/test/test_model.py
--- a/spyvm/test/test_model.py
+++ b/spyvm/test/test_model.py
@@ -1,4 +1,5 @@
 import py
+import math
 from spyvm import model, shadow
 from spyvm.shadow import MethodNotFound
 from spyvm import objspace, error
@@ -251,8 +252,11 @@
 
 def test_float_at_put():
     target = model.W_Float(1.0)
-    for f in [1.0, -1.0, 1.1, 64.4, -0.0]:
+    for f in [1.0, -1.0, 1.1, 64.4, -0.0, float('nan'), float('inf')]:
         source = model.W_Float(f)
         target.store(space, 0, source.fetch(space, 0))
         target.store(space, 1, source.fetch(space, 1))
-        assert target.value == f
+        if math.isnan(f):
+            assert math.isnan(target.value)
+        else:
+            assert target.value == f


More information about the pypy-commit mailing list