Commits

mattip committed 401cb59

more tests

Comments (0)

Files changed (2)

lib_pypy/numpypy/multiarray/__init__.py

             tmp[:i] = retVal[:i]
             retVal = tmp
         retVal[i] = value
+    if i<count:
+        raise ValueError('iterator too short')
     return retVal[:i+1]
+
+def fromfile(_file, dtype=float, count=-1, sep=''):
+    raise ValueError('not implemented yet')

lib_pypy/numpypy/test/test_multiarray.py

     b = multiarray.fromiter(iterable, np.dtype(float))
     assert b.dtype == np.dtype(float)
     assert all(b == [0., 1., 4., 9., 16.]) == True
+    iterable = (x*x for x in range(5))
+    raises(ValueError, multiarray.fromiter, iterable, np.dtype(float), 10)
+    iterable = (x*x for x in range(5))
+    b = multiarray.fromiter(iterable, np.dtype(float), 3)
+    assert all(b == [0., 1., 4.]) == True