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

Function test_codecs_encoding

pandas/tests/io/test_common.py:513–527  ·  view source on GitHub ↗
(format, temp_file)

Source from the content-addressed store, hash-verified

511
512@pytest.mark.parametrize("format", ["csv", "json"])
513def test_codecs_encoding(format, temp_file):
514 # GH39247
515 expected = pd.DataFrame(
516 1.1 * np.arange(120).reshape((30, 4)),
517 columns=pd.Index(list("ABCD")),
518 index=pd.Index([f"i-{i}" for i in range(30)]),
519 )
520 with open(temp_file, mode="w", encoding="utf-8") as handle:
521 getattr(expected, f"to_{format}")(handle)
522 with open(temp_file, encoding="utf-8") as handle:
523 if format == "csv":
524 df = pd.read_csv(handle, index_col=0)
525 else:
526 df = pd.read_json(handle)
527 tm.assert_frame_equal(expected, df)
528
529
530def test_codecs_get_writer_reader(temp_file):

Callers

nothing calls this directly

Calls 2

reshapeMethod · 0.45
read_csvMethod · 0.45

Tested by

no test coverage detected