(self)
| 1786 | 'f': [3, 6]}]) |
| 1787 | |
| 1788 | def test_encoding(self): |
| 1789 | # latin-1 (invalid utf-8) |
| 1790 | rows = b"a,b\nun,\xe9l\xe9phant" |
| 1791 | read_options = ReadOptions() |
| 1792 | reader = self.open_bytes(rows, read_options=read_options) |
| 1793 | expected_schema = pa.schema([('a', pa.string()), |
| 1794 | ('b', pa.binary())]) |
| 1795 | self.check_reader(reader, expected_schema, |
| 1796 | [{'a': ["un"], |
| 1797 | 'b': [b"\xe9l\xe9phant"]}]) |
| 1798 | |
| 1799 | read_options.encoding = 'latin1' |
| 1800 | reader = self.open_bytes(rows, read_options=read_options) |
| 1801 | expected_schema = pa.schema([('a', pa.string()), |
| 1802 | ('b', pa.string())]) |
| 1803 | self.check_reader(reader, expected_schema, |
| 1804 | [{'a': ["un"], |
| 1805 | 'b': ["éléphant"]}]) |
| 1806 | |
| 1807 | # utf-16 |
| 1808 | rows = (b'\xff\xfea\x00,\x00b\x00\n\x00u\x00n\x00,' |
| 1809 | b'\x00\xe9\x00l\x00\xe9\x00p\x00h\x00a\x00n\x00t\x00') |
| 1810 | read_options.encoding = 'utf16' |
| 1811 | reader = self.open_bytes(rows, read_options=read_options) |
| 1812 | expected_schema = pa.schema([('a', pa.string()), |
| 1813 | ('b', pa.string())]) |
| 1814 | self.check_reader(reader, expected_schema, |
| 1815 | [{'a': ["un"], |
| 1816 | 'b': ["éléphant"]}]) |
| 1817 | |
| 1818 | def test_small_random_csv(self): |
| 1819 | csv, expected = make_random_csv(num_cols=2, num_rows=10) |
nothing calls this directly
no test coverage detected