| 152 | |
| 153 | |
| 154 | def test_open_args(using_infer_string): |
| 155 | not_written = f"{uuid.uuid4()}.h5" |
| 156 | df = DataFrame( |
| 157 | 1.1 * np.arange(120).reshape((30, 4)), |
| 158 | columns=Index(list("ABCD"), dtype=object), |
| 159 | index=Index([f"i-{i}" for i in range(30)], dtype=object), |
| 160 | ) |
| 161 | |
| 162 | # create an in memory store |
| 163 | store = HDFStore( |
| 164 | not_written, mode="a", driver="H5FD_CORE", driver_core_backing_store=0 |
| 165 | ) |
| 166 | store["df"] = df |
| 167 | store.append("df2", df) |
| 168 | |
| 169 | expected = df.copy() |
| 170 | if using_infer_string: |
| 171 | expected.index = expected.index.astype("str") |
| 172 | expected.columns = expected.columns.astype("str") |
| 173 | |
| 174 | tm.assert_frame_equal(store["df"], expected) |
| 175 | tm.assert_frame_equal(store["df2"], expected) |
| 176 | |
| 177 | store.close() |
| 178 | |
| 179 | # the file should not have actually been written |
| 180 | assert not os.path.exists(not_written) |
| 181 | |
| 182 | |
| 183 | def test_flush(temp_h5_path): |