Creates a _MockFileSystem with two parquet files that have promotable schemas. - file1: value: int8, dictionary: dictionary - file2: value: uint16, dictionary: dictionary
()
| 149 | |
| 150 | @pytest.fixture |
| 151 | def promotable_mockfs(): |
| 152 | """ |
| 153 | Creates a _MockFileSystem with two parquet files that have promotable schemas. |
| 154 | - file1: value: int8, dictionary: dictionary<int8, string> |
| 155 | - file2: value: uint16, dictionary: dictionary<int16, string> |
| 156 | """ |
| 157 | mockfs = fs._MockFileSystem() |
| 158 | |
| 159 | table1 = pa.table({ |
| 160 | 'value': pa.array([1, 2], type=pa.int8()), |
| 161 | 'dictionary': pa.DictionaryArray.from_arrays( |
| 162 | pa.array([0, 1], type=pa.int8()), |
| 163 | ['a', 'b'], |
| 164 | ), |
| 165 | }) |
| 166 | table2 = pa.table({ |
| 167 | 'value': pa.array([3, 4], type=pa.uint16()), |
| 168 | 'dictionary': pa.DictionaryArray.from_arrays( |
| 169 | pa.array([1, 0], type=pa.int16()), |
| 170 | ['d', 'c'], |
| 171 | ), |
| 172 | }) |
| 173 | |
| 174 | mockfs.create_dir('subdir/zzz') |
| 175 | path1 = 'subdir/zzz/file1.parquet' |
| 176 | with mockfs.open_output_stream(path1) as out: |
| 177 | pq.write_table(table1, out) |
| 178 | |
| 179 | path2 = 'subdir/zzz/file2.parquet' |
| 180 | with mockfs.open_output_stream(path2) as out: |
| 181 | pq.write_table(table2, out) |
| 182 | |
| 183 | return mockfs, path1, path2 |
| 184 | |
| 185 | |
| 186 | @pytest.fixture |
nothing calls this directly
no test coverage detected