(self)
| 1856 | 'f': [3, 6]}]) |
| 1857 | |
| 1858 | def test_encoding(self): |
| 1859 | # latin-1 (invalid utf-8) |
| 1860 | rows = b"a,b\nun,\xe9l\xe9phant" |
| 1861 | read_options = ReadOptions() |
| 1862 | reader = self.open_bytes(rows, read_options=read_options) |
| 1863 | expected_schema = pa.schema([('a', pa.string()), |
| 1864 | ('b', pa.binary())]) |
| 1865 | self.check_reader(reader, expected_schema, |
| 1866 | [{'a': ["un"], |
| 1867 | 'b': [b"\xe9l\xe9phant"]}]) |
| 1868 | |
| 1869 | read_options.encoding = 'latin1' |
| 1870 | reader = self.open_bytes(rows, read_options=read_options) |
| 1871 | expected_schema = pa.schema([('a', pa.string()), |
| 1872 | ('b', pa.string())]) |
| 1873 | self.check_reader(reader, expected_schema, |
| 1874 | [{'a': ["un"], |
| 1875 | 'b': ["éléphant"]}]) |
| 1876 | |
| 1877 | # utf-16 |
| 1878 | rows = (b'\xff\xfea\x00,\x00b\x00\n\x00u\x00n\x00,' |
| 1879 | b'\x00\xe9\x00l\x00\xe9\x00p\x00h\x00a\x00n\x00t\x00') |
| 1880 | read_options.encoding = 'utf16' |
| 1881 | reader = self.open_bytes(rows, read_options=read_options) |
| 1882 | expected_schema = pa.schema([('a', pa.string()), |
| 1883 | ('b', pa.string())]) |
| 1884 | self.check_reader(reader, expected_schema, |
| 1885 | [{'a': ["un"], |
| 1886 | 'b': ["éléphant"]}]) |
| 1887 | |
| 1888 | def test_small_random_csv(self): |
| 1889 | csv, expected = make_random_csv(num_cols=2, num_rows=10) |
nothing calls this directly
no test coverage detected