(self)
| 861 | BadFileLike(), dtype=np.dtype("i"), filelike=True) |
| 862 | |
| 863 | def test_filelike_bad_read(self): |
| 864 | # Can only be reached if loadtxt opens the file, so it is hard to do |
| 865 | # via the public interface (although maybe not impossible considering |
| 866 | # the current "DataClass" backing). |
| 867 | |
| 868 | class BadFileLike: |
| 869 | counter = 0 |
| 870 | |
| 871 | def read(self, size): |
| 872 | return 1234 # not a string! |
| 873 | |
| 874 | with pytest.raises(TypeError, |
| 875 | match="non-string returned while reading data"): |
| 876 | np.core._multiarray_umath._load_from_filelike( |
| 877 | BadFileLike(), dtype=np.dtype("i"), filelike=True) |
| 878 | |
| 879 | def test_not_an_iter(self): |
| 880 | with pytest.raises(TypeError, |
nothing calls this directly
no test coverage detected