Author: Ronan Lamy <[email protected]>
Branch: fix-broken-types
Changeset: r88563:483405a0e443
Date: 2016-11-23 02:20 +0000
http://bitbucket.org/pypy/pypy/changeset/483405a0e443/

Log:    fix some tests

diff --git a/rpython/rtyper/test/test_rbuiltin.py 
b/rpython/rtyper/test/test_rbuiltin.py
--- a/rpython/rtyper/test/test_rbuiltin.py
+++ b/rpython/rtyper/test/test_rbuiltin.py
@@ -132,17 +132,11 @@
         assert self.interpret(fn, (1.9, 2.)) == 1.9
         assert self.interpret(fn, (1.5, -1.4)) == -1.4
 
-    def test_float_int_min(self):
-        def fn(i, j):
-            return min(i, j)
-        assert self.interpret(fn, (1.9, 2)) == 1.9
-        assert self.interpret(fn, (1.5, -1)) == -1
-
     def test_float_max(self):
         def fn(i, j):
             return max(i,j)
         assert self.interpret(fn, (1.0, 2.)) == 2
-        assert self.interpret(fn, (1.1, -1)) == 1.1
+        assert self.interpret(fn, (1.1, -1.)) == 1.1
 
     def test_builtin_math_floor(self):
         def fn(f):
@@ -165,18 +159,18 @@
     def test_builtin_math_frexp(self):
         def fn(f):
             return math.frexp(f)
-        for x in (.5, 1, 1.5, 10/3.0):
+        for x in (.5, 1., 1.5, 10/3.0):
             for y in (1, -1):
                 res = self.interpret(fn, [x*y])
                 mantissa, exponent = math.frexp(x*y)
-                assert (self.float_eq(res.item0, mantissa) and
-                        self.float_eq(res.item1, exponent))
+                assert self.float_eq(res.item0, mantissa)
+                assert res.item1 == exponent
 
     def test_builtin_math_ldexp(self):
         def fn(a, b):
             return math.ldexp(a, b)
-        assert self.interpret(fn, [1, 2]) == 4
-        self.interpret_raises(OverflowError, fn, [1, 100000])
+        assert self.interpret(fn, [1., 2]) == 4
+        self.interpret_raises(OverflowError, fn, [1., 100000])
 
     def test_builtin_math_modf(self):
         def fn(f):
diff --git a/rpython/rtyper/test/test_rfloat.py 
b/rpython/rtyper/test/test_rfloat.py
--- a/rpython/rtyper/test/test_rfloat.py
+++ b/rpython/rtyper/test/test_rfloat.py
@@ -150,9 +150,9 @@
         from rpython.rlib import rfloat
         def fn(x, y):
             return rfloat.copysign(x, y)
-        assert self.interpret(fn, [42, -1]) == -42
-        assert self.interpret(fn, [42, -0.0]) == -42
-        assert self.interpret(fn, [42, 0.0]) == 42
+        assert self.interpret(fn, [42., -1.]) == -42.
+        assert self.interpret(fn, [42., -0.]) == -42.
+        assert self.interpret(fn, [42., 0.]) == 42.
 
     def test_rstring_to_float(self):
         from rpython.rlib.rfloat import rstring_to_float
diff --git a/rpython/rtyper/test/test_rpbc.py b/rpython/rtyper/test/test_rpbc.py
--- a/rpython/rtyper/test/test_rpbc.py
+++ b/rpython/rtyper/test/test_rpbc.py
@@ -1038,7 +1038,7 @@
         fr3 = Freezing()
         fr1.value = 10
         fr2.value = 5
-        fr3.value = 2.5
+        fr3.value = 3
         def pick12(i):
             if i > 0:
                 return fr1
@@ -1056,8 +1056,8 @@
         for i in [0, 5, 10]:
             res = self.interpret(f, [i])
             item0, item1 = self.ll_unpack_tuple(res, 2)
-            assert type(item0) is int   # precise
-            assert type(item1) in (float, int)  # we get int on JS
+            assert type(item0) is int
+            assert type(item1) is int
             assert item0 == f(i)[0]
             assert item1 == f(i)[1]
 
@@ -1068,7 +1068,7 @@
         class fr3(base): pass
         fr1.value = 10
         fr2.value = 5
-        fr3.value = 2.5
+        fr3.value = 3
         def pick12(i):
             if i > 0:
                 return fr1
@@ -1086,8 +1086,8 @@
         for i in [0, 5, 10]:
             res = self.interpret(f, [i])
             item0, item1 = self.ll_unpack_tuple(res, 2)
-            assert type(item0) is int   # precise
-            assert type(item1) in (float, int)  # we get int on JS
+            assert type(item0) is int
+            assert type(item1) is int
             assert item0 == f(i)[0]
             assert item1 == f(i)[1]
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to