[pypy-commit] pypy default: micronumpy: Implement numpy.empty(), and test.
MostAwesomeDude
noreply at buildbot.pypy.org
Fri Jun 10 22:43:18 CEST 2011
Author: Corbin Simpson <MostAwesomeDude at gmail.com>
Branch:
Changeset: r44880:4aa39565c86c
Date: 2011-06-10 13:42 -0700
http://bitbucket.org/pypy/pypy/changeset/4aa39565c86c/
Log: micronumpy: Implement numpy.empty(), and test.
Using zeros() for empty(); fulfills the contract just fine.
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
@@ -8,6 +8,7 @@
interpleveldefs = {
'array': 'interp_numarray.SingleDimArray',
'zeros': 'interp_numarray.zeros',
+ 'empty': 'interp_numarray.zeros',
# ufuncs
'absolute': 'interp_ufuncs.absolute',
diff --git a/pypy/module/micronumpy/test/test_numarray.py b/pypy/module/micronumpy/test/test_numarray.py
--- a/pypy/module/micronumpy/test/test_numarray.py
+++ b/pypy/module/micronumpy/test/test_numarray.py
@@ -18,6 +18,16 @@
a[13] = 5.3
assert a[13] == 5.3
+ def test_empty(self):
+ """
+ Test that empty() works.
+ """
+
+ from numpy import empty
+ a = empty(2)
+ a[1] = 1.0
+ assert a[1] == 1.0
+
def test_iterator_init(self):
from numpy import array
a = array(range(5))
@@ -138,4 +148,4 @@
b = a + a
c = b + b
b[1] = 5
- assert c[1] == 4
\ No newline at end of file
+ assert c[1] == 4
More information about the pypy-commit
mailing list