summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_io.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2011-04-03 17:45:51 -0600
committerCharles Harris <charlesr.harris@gmail.com>2011-04-03 17:45:51 -0600
commita528b98550f9e411342659069c5ac8fb7bca7bf3 (patch)
tree2c40ae1aecab1623f9fd22d8b76fd94bcf01f5f0 /numpy/lib/tests/test_io.py
parent9445a3d284c5cbc756fee1e6c313a114e937ddea (diff)
downloadnumpy-a528b98550f9e411342659069c5ac8fb7bca7bf3.tar.gz
ENH: Let genfromtxt accept generators as text sources. Add test
for that case.
Diffstat (limited to 'numpy/lib/tests/test_io.py')
-rw-r--r--numpy/lib/tests/test_io.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
index 1ed333165..53068838a 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -488,7 +488,7 @@ class TestLoadTxt(TestCase):
def test_generator_source(self):
def count():
for i in range(10):
- yield "%d" % i
+ yield asbytes("%d" % i)
res = np.loadtxt(count())
assert_array_equal(res, np.arange(10))
@@ -1323,6 +1323,14 @@ M 33 21.99
os.close(f)
os.unlink(name)
+ def test_gft_generator_source(self):
+ def count():
+ for i in range(10):
+ yield asbytes("%d" % i)
+
+ res = np.genfromtxt(count())
+ assert_array_equal(res, np.arange(10))
+
def test_gzip_load():
a = np.random.random((5, 5))