diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2011-04-03 12:55:26 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2011-04-03 12:55:26 -0600 |
commit | 0a6be6e67b3f63d298fc8af60fcfe39dfbc6a6c3 (patch) | |
tree | ef5c7d93780410c65c06c62322b87e3753de62aa /numpy/lib/tests/test_io.py | |
parent | 6b6edfd702a0782ff665d009490b02538a5e0b28 (diff) | |
download | numpy-0a6be6e67b3f63d298fc8af60fcfe39dfbc6a6c3.tar.gz |
ENH: ticket #1616, let loadtxt accept generators in additions to
file names and file like objects. Add test for for new functionality.
Diffstat (limited to 'numpy/lib/tests/test_io.py')
-rw-r--r-- | numpy/lib/tests/test_io.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py index 30c0998dc..f9d5569de 100644 --- a/numpy/lib/tests/test_io.py +++ b/numpy/lib/tests/test_io.py @@ -485,6 +485,13 @@ class TestLoadTxt(TestCase): e = StringIO() assert_(np.loadtxt(e, ndmin=2).shape == (0, 1,)) + def test_generator_source(self): + def count(): + for i in range(10): + yield "%d" % i + + res = np.loadtxt(count()) + assert_array_equal(res, np.arange(10)) class Testfromregex(TestCase): def test_record(self): |