Author: Matti Picus <matti.pi...@gmail.com>
Branch: pypy-pyarray
Changeset: r67025:665e8edf7ca1
Date: 2013-09-20 08:59 +0300
http://bitbucket.org/pypy/pypy/changeset/665e8edf7ca1/

Log:    test numpy.__all__, numpy.get_include()

diff --git a/TODO.txt b/TODO.txt
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,7 +1,6 @@
 TODO list by mattip
 ===================
 
-- test "from numpypy import *" esp. get_include()
 - test all *.h files under pypy/module/cpyext/include/numpy
 - make sure copy_header_files() in api.py is used in package.py
 - test, implement use of __array_prepare__()
diff --git a/lib_pypy/numpy.py b/lib_pypy/numpy.py
--- a/lib_pypy/numpy.py
+++ b/lib_pypy/numpy.py
@@ -7,5 +7,6 @@
         UserWarning) # XXX is this the best warning type?
 
 from numpypy import *
-
-
+import numpypy
+__all__ = numpypy.__all__
+del numpypy
diff --git a/pypy/module/test_lib_pypy/numpypy/test_numpy.py 
b/pypy/module/test_lib_pypy/numpypy/test_numpy.py
--- a/pypy/module/test_lib_pypy/numpypy/test_numpy.py
+++ b/pypy/module/test_lib_pypy/numpypy/test_numpy.py
@@ -31,7 +31,9 @@
         import sys
         from warnings import catch_warnings
         # XXX why are numpypy and numpy modules already imported?
-        print sys.modules.keys()
+        mods = [d for d in sys.modules.keys() if d.find('numpy') >= 0]
+        if mods:
+            skip('%s already imported' % mods)
 
         with catch_warnings(record=True) as w:
             import numpy
@@ -91,3 +93,14 @@
         assert numpypy.PZERO == numpypy.NZERO == 0.0
         assert math.isinf(numpypy.inf)
         assert math.isnan(numpypy.nan)
+
+    def test___all__(self):
+        import numpy
+        assert '__all__' in numpy
+        assert 'numpypy' not in dir(numpy)
+
+    def test_get_include(self):
+        import numpy, os
+        assert 'get_include' in dir(numpy)
+        path = numpy.get_include()
+        assert os.path.exists(path + '/numpy/arrayobject.h')
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to