| 2384 | assert_array_equal(res, tgt) |
| 2385 | |
| 2386 | def test_gft_from_gzip(self): |
| 2387 | # Test that we can load data from a gzipped file |
| 2388 | wanted = np.arange(6).reshape((2, 3)) |
| 2389 | linesep = ('\n', '\r\n', '\r') |
| 2390 | |
| 2391 | for sep in linesep: |
| 2392 | data = '0 1 2' + sep + '3 4 5' |
| 2393 | s = BytesIO() |
| 2394 | with gzip.GzipFile(fileobj=s, mode='w') as g: |
| 2395 | g.write(asbytes(data)) |
| 2396 | |
| 2397 | with temppath(suffix='.gz2') as name: |
| 2398 | with open(name, 'w') as f: |
| 2399 | f.write(data) |
| 2400 | assert_array_equal(np.genfromtxt(name), wanted) |
| 2401 | |
| 2402 | def test_gft_using_generator(self): |
| 2403 | # gft doesn't work with unicode. |