()
| 458 | |
| 459 | |
| 460 | def test_read_from_bad_generator(): |
| 461 | def gen(): |
| 462 | for entry in ["1,2", b"3, 5", 12738]: |
| 463 | yield entry |
| 464 | |
| 465 | with pytest.raises( |
| 466 | TypeError, match=r"non-string returned while reading data"): |
| 467 | np.loadtxt(gen(), dtype="i, i", delimiter=",") |
| 468 | |
| 469 | |
| 470 | @pytest.mark.skipif(not HAS_REFCOUNT, reason="Python lacks refcounts") |