()
| 114 | |
| 115 | @pytest.fixture |
| 116 | def mockfs(): |
| 117 | mockfs = fs._MockFileSystem() |
| 118 | |
| 119 | directories = [ |
| 120 | 'subdir/1/xxx', |
| 121 | 'subdir/2/yyy', |
| 122 | ] |
| 123 | |
| 124 | for i, directory in enumerate(directories): |
| 125 | path = f'{directory}/file{i}.parquet' |
| 126 | mockfs.create_dir(directory) |
| 127 | with mockfs.open_output_stream(path) as out: |
| 128 | data = [ |
| 129 | list(range(5)), |
| 130 | list(map(float, range(5))), |
| 131 | list(map(str, range(5))), |
| 132 | [i] * 5, |
| 133 | [{'a': j % 3, 'b': str(j % 3)} for j in range(5)], |
| 134 | ] |
| 135 | schema = pa.schema([ |
| 136 | ('i64', pa.int64()), |
| 137 | ('f64', pa.float64()), |
| 138 | ('str', pa.string()), |
| 139 | ('const', pa.int64()), |
| 140 | ('struct', pa.struct({'a': pa.int64(), 'b': pa.string()})), |
| 141 | ]) |
| 142 | batch = pa.record_batch(data, schema=schema) |
| 143 | table = pa.Table.from_batches([batch]) |
| 144 | |
| 145 | pq.write_table(table, out) |
| 146 | |
| 147 | return mockfs |
| 148 | |
| 149 | |
| 150 | @pytest.fixture |
nothing calls this directly
no test coverage detected