Commits

Brian Kearns committed 2568145

update numarray min/max tests to show why the app-level workaround is the wrong approach

Comments (0)

Files changed (1)

pypy/module/micronumpy/test/test_numarray.py

         assert (a.mean(1) == [0.5, 2.5, 4.5, 6.5, 8.5]).all()
 
     def test_sum(self):
-        from _numpypy import array
+        from _numpypy import array, zeros
         a = array(range(5))
         assert a.sum() == 10
         assert a[:4].sum() == 6
         assert b == d
         assert b is d
 
+        assert list(zeros((0, 2)).sum(axis=1)) == []
+
     def test_reduce_nd(self):
         from numpypy import arange, array, multiply
         a = arange(15).reshape(5, 3)
         assert a[:4].prod() == 24.0
 
     def test_max(self):
-        from _numpypy import array
+        from _numpypy import array, zeros
         a = array([-1.2, 3.4, 5.7, -3.0, 2.7])
         assert a.max() == 5.7
         b = array([])
         raises(ValueError, "b.max()")
 
+        assert list(zeros((0, 2)).max(axis=1)) == []
+
     def test_max_add(self):
         from _numpypy import array
         a = array([-1.2, 3.4, 5.7, -3.0, 2.7])
         assert (a + a).max() == 11.4
 
     def test_min(self):
-        from _numpypy import array
+        from _numpypy import array, zeros
         a = array([-1.2, 3.4, 5.7, -3.0, 2.7])
         assert a.min() == -3.0
         b = array([])
         raises(ValueError, "b.min()")
 
+        assert list(zeros((0, 2)).min(axis=1)) == []
+
     def test_argmax(self):
         from _numpypy import array
         a = array([-1.2, 3.4, 5.7, -3.0, 2.7])
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.