From 21899e5575af0f2889c77d1f5708d83516e73a17 Mon Sep 17 00:00:00 2001 From: Lu Yibo <1478354316@qq.com> Date: Tue, 4 Nov 2025 19:04:48 +0800 Subject: [PATCH] TST: replace ensure_clean with temp_file in pandas/tests/io/formats/test_to_csv.py (xref #62435) --- pandas/tests/io/formats/test_to_csv.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/tests/io/formats/test_to_csv.py b/pandas/tests/io/formats/test_to_csv.py index f70875172ccc8..2bd9357862ecb 100644 --- a/pandas/tests/io/formats/test_to_csv.py +++ b/pandas/tests/io/formats/test_to_csv.py @@ -542,7 +542,7 @@ def test_to_csv_compression( to_compression = "infer" if to_infer else compression read_compression = "infer" if read_infer else compression - path_ext = str(temp_file) + "." + compression_to_extension[compression] + path_ext = temp_file.with_suffix("." + compression_to_extension[compression]) df.to_csv(path_ext, compression=to_compression) result = pd.read_csv(path_ext, index_col=0, compression=read_compression) tm.assert_frame_equal(result, df) @@ -556,7 +556,7 @@ def test_to_csv_compression_dict(self, compression_only, temp_file): "zstd": "zst", }.get(method, method) - path = str(temp_file) + "." + extension + path = temp_file.with_suffix("." + extension) df.to_csv(path, compression={"method": method}) read_df = pd.read_csv(path, index_col=0) tm.assert_frame_equal(read_df, df) @@ -576,7 +576,7 @@ def test_to_csv_zip_arguments(self, compression, archive_name, temp_file): # GH 26023 df = DataFrame({"ABC": [1]}) - path = str(temp_file) + ".zip" + path = temp_file.with_suffix(".zip") df.to_csv( path, compression={"method": compression, "archive_name": archive_name} )