(self)
| 844 | object(), dtype=np.dtype("i"), filelike=True) |
| 845 | |
| 846 | def test_filelike_read_fails(self): |
| 847 | # Can only be reached if loadtxt opens the file, so it is hard to do |
| 848 | # via the public interface (although maybe not impossible considering |
| 849 | # the current "DataClass" backing). |
| 850 | class BadFileLike: |
| 851 | counter = 0 |
| 852 | |
| 853 | def read(self, size): |
| 854 | self.counter += 1 |
| 855 | if self.counter > 20: |
| 856 | raise RuntimeError("Bad bad bad!") |
| 857 | return "1,2,3\n" |
| 858 | |
| 859 | with pytest.raises(RuntimeError, match="Bad bad bad!"): |
| 860 | np.core._multiarray_umath._load_from_filelike( |
| 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 |
nothing calls this directly
no test coverage detected