Author: Maciej Fijalkowski <[email protected]>
Branch:
Changeset: r59438:4073ceef4ea7
Date: 2012-12-15 11:17 +0200
http://bitbucket.org/pypy/pypy/changeset/4073ceef4ea7/
Log: Fix few strange ufuncs on ints
diff --git a/pypy/module/micronumpy/test/test_ufuncs.py
b/pypy/module/micronumpy/test/test_ufuncs.py
--- a/pypy/module/micronumpy/test/test_ufuncs.py
+++ b/pypy/module/micronumpy/test/test_ufuncs.py
@@ -672,6 +672,8 @@
def test_isnan_isinf(self):
from _numpypy import isnan, isinf, float64, array
assert isnan(float('nan'))
+ assert not isnan(3)
+ assert not isinf(3)
assert isnan(float64(float('nan')))
assert not isnan(3)
assert isinf(float('inf'))
@@ -686,6 +688,8 @@
def test_isposinf_isneginf(self):
from _numpypy import isneginf, isposinf
assert isposinf(float('inf'))
+ assert not isposinf(3)
+ assert not isneginf(3)
assert not isposinf(float('-inf'))
assert not isposinf(float('nan'))
assert not isposinf(0)
@@ -705,6 +709,7 @@
[True, True, True, True]).all()
assert (isfinite([ninf, inf, -nan, nan]) ==
[False, False, False, False]).all()
+ assert (isfinite([1, 2, 3]) == [True, True, True]).all()
a = [complex(0, 0), complex(1e50, -1e-50), complex(inf, 0),
complex(inf, inf), complex(inf, ninf), complex(0, inf),
diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
--- a/pypy/module/micronumpy/types.py
+++ b/pypy/module/micronumpy/types.py
@@ -416,6 +416,26 @@
assert v == 0
return 0
+ @raw_unary_op
+ def isfinite(self, v):
+ return True
+
+ @raw_unary_op
+ def isnan(self, v):
+ return False
+
+ @raw_unary_op
+ def isinf(self, v):
+ return False
+
+ @raw_unary_op
+ def isposinf(self, v):
+ return False
+
+ @raw_unary_op
+ def isneginf(self, v):
+ return False
+
@simple_binary_op
def bitwise_and(self, v1, v2):
return v1 & v2
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit