Author: Alex Gaynor <[email protected]>
Branch:
Changeset: r47764:59460302c713
Date: 2011-10-02 02:55 -0400
http://bitbucket.org/pypy/pypy/changeset/59460302c713/
Log: expose numpy.inf
diff --git a/pypy/module/micronumpy/__init__.py
b/pypy/module/micronumpy/__init__.py
--- a/pypy/module/micronumpy/__init__.py
+++ b/pypy/module/micronumpy/__init__.py
@@ -50,4 +50,5 @@
appleveldefs = {
'average': 'app_numpy.average',
'mean': 'app_numpy.mean',
+ 'inf': 'app_numpy.inf',
}
diff --git a/pypy/module/micronumpy/app_numpy.py
b/pypy/module/micronumpy/app_numpy.py
--- a/pypy/module/micronumpy/app_numpy.py
+++ b/pypy/module/micronumpy/app_numpy.py
@@ -1,5 +1,8 @@
import numpy
+
+inf = float("inf")
+
def average(a):
# This implements a weighted average, for now we don't implement the
# weighting, just the average part!
@@ -8,4 +11,4 @@
def mean(a):
if not hasattr(a, "mean"):
a = numpy.array(a)
- return a.mean()
\ No newline at end of file
+ return a.mean()
diff --git a/pypy/module/micronumpy/test/test_module.py
b/pypy/module/micronumpy/test/test_module.py
--- a/pypy/module/micronumpy/test/test_module.py
+++ b/pypy/module/micronumpy/test/test_module.py
@@ -10,4 +10,9 @@
def test_average(self):
from numpy import array, average
assert average(range(10)) == 4.5
- assert average(array(range(10))) == 4.5
\ No newline at end of file
+ assert average(array(range(10))) == 4.5
+
+ def test_inf(self):
+ from numpy import inf
+ assert type(inf) is float
+ assert inf == float("inf")
\ No newline at end of file
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit