Commits

mattip committed 665e8ed

test numpy.__all__, numpy.get_include()

Comments (0)

Files changed (3)

 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__()

lib_pypy/numpy.py

         UserWarning) # XXX is this the best warning type?
 
 from numpypy import *
-
-
+import numpypy
+__all__ = numpypy.__all__
+del numpypy

pypy/module/test_lib_pypy/numpypy/test_numpy.py

         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
         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')