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