MCPcopy
hub / github.com/pandas-dev/pandas / test_read_infer

Method test_read_infer

pandas/tests/io/test_pickle.py:394–412  ·  view source on GitHub ↗
(self, compression_ext, get_random_path, temp_file)

Source from the content-addressed store, hash-verified

392 tm.assert_frame_equal(df, df2)
393
394 def test_read_infer(self, compression_ext, get_random_path, temp_file):
395 p1 = temp_file.parent / f"{temp_file.stem}.raw"
396 p2 = temp_file.parent / f"{temp_file.stem}{compression_ext}"
397 compression = self._extension_to_compression.get(compression_ext.lower())
398 df = DataFrame(
399 1.1 * np.arange(120).reshape((30, 4)),
400 columns=Index(list("ABCD"), dtype=object),
401 index=Index([f"i-{i}" for i in range(30)], dtype=object),
402 )
403
404 # write to uncompressed file
405 df.to_pickle(p1, compression=None)
406
407 # compress
408 self.compress_file(p1, p2, compression=compression)
409
410 # read compressed file by inferred compression method
411 df2 = pd.read_pickle(p2)
412 tm.assert_frame_equal(df, df2)
413
414
415# ---------------------

Callers

nothing calls this directly

Calls 7

compress_fileMethod · 0.95
DataFrameClass · 0.90
IndexClass · 0.90
lowerMethod · 0.80
to_pickleMethod · 0.80
getMethod · 0.45
reshapeMethod · 0.45

Tested by

no test coverage detected