(self)
| 1191 | @pytest.mark.skipif(locale.getpreferredencoding() == 'ANSI_X3.4-1968', |
| 1192 | reason="Wrong preferred encoding") |
| 1193 | def test_binary_load(self): |
| 1194 | butf8 = b"5,6,7,\xc3\x95scarscar\r\n15,2,3,hello\r\n"\ |
| 1195 | b"20,2,3,\xc3\x95scar\r\n" |
| 1196 | sutf8 = butf8.decode("UTF-8").replace("\r", "").splitlines() |
| 1197 | with temppath() as path: |
| 1198 | with open(path, "wb") as f: |
| 1199 | f.write(butf8) |
| 1200 | with open(path, "rb") as f: |
| 1201 | x = np.loadtxt(f, encoding="UTF-8", dtype=np.str_) |
| 1202 | assert_array_equal(x, sutf8) |
| 1203 | # test broken latin1 conversion people now rely on |
| 1204 | with open(path, "rb") as f: |
| 1205 | x = np.loadtxt(f, encoding="UTF-8", dtype="S") |
| 1206 | x = [b'5,6,7,\xc3\x95scarscar', b'15,2,3,hello', b'20,2,3,\xc3\x95scar'] |
| 1207 | assert_array_equal(x, np.array(x, dtype="S")) |
| 1208 | |
| 1209 | def test_max_rows(self): |
| 1210 | c = TextIO() |
nothing calls this directly
no test coverage detected