Skip to content

Commit

Permalink
fix gcs file path
Browse files Browse the repository at this point in the history
  • Loading branch information
chelsea-lin committed Mar 20, 2024
1 parent d7ce449 commit 7b00656
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 3 additions & 6 deletions tests/system/small/test_dataframe_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,10 @@ def test_to_csv_index(
# read_csv will decode into bytes inproperly, convert_pandas_dtypes will encode properly from string
dtype.pop("bytes_col")
gcs_df = pd.read_csv(
path,
path.replace("*", "000000000000"),
dtype=dtype,
date_format={"timestamp_col": "YYYY-MM-DD HH:MM:SS Z"},
index_col=index_col,
storage_options=dict(expand=True),
)
convert_pandas_dtypes(gcs_df, bytes_col=True)
gcs_df.index.name = scalars_df.index.name
Expand Down Expand Up @@ -188,12 +187,11 @@ def test_to_csv_tabs(
# read_csv will decode into bytes inproperly, convert_pandas_dtypes will encode properly from string
dtype.pop("bytes_col")
gcs_df = pd.read_csv(
path,
path.replace("*", "000000000000"),
sep="\t",
dtype=dtype,
date_format={"timestamp_col": "YYYY-MM-DD HH:MM:SS Z"},
index_col=index_col,
storage_options=dict(expand=True),
)
convert_pandas_dtypes(gcs_df, bytes_col=True)
gcs_df.index.name = scalars_df.index.name
Expand Down Expand Up @@ -435,10 +433,9 @@ def test_to_json_index_records_orient(
scalars_df.to_json(path, index=index, orient="records", lines=True)

gcs_df = pd.read_json(
path,
path.replace("*", "000000000000"),
lines=True,
convert_dates=["datetime_col"],
storage_options=dict(expand=True),
)
convert_pandas_dtypes(gcs_df, bytes_col=True)
if index and scalars_df.index.name is not None:
Expand Down
4 changes: 2 additions & 2 deletions tests/system/small/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -2393,7 +2393,7 @@ def test_to_frame(scalars_dfs):
def test_to_json(gcs_folder, scalars_df_index, scalars_pandas_df_index):
path = gcs_folder + "test_series_to_json*.jsonl"
scalars_df_index["int64_col"].to_json(path, lines=True, orient="records")
gcs_df = pd.read_json(path, lines=True, storage_options=dict(expand=True))
gcs_df = pd.read_json(path.replace("*", "000000000000"), lines=True)

pd.testing.assert_series_equal(
gcs_df["int64_col"].astype(pd.Int64Dtype()),
Expand All @@ -2406,7 +2406,7 @@ def test_to_json(gcs_folder, scalars_df_index, scalars_pandas_df_index):
def test_to_csv(gcs_folder, scalars_df_index, scalars_pandas_df_index):
path = gcs_folder + "test_series_to_csv*.csv"
scalars_df_index["int64_col"].to_csv(path)
gcs_df = pd.read_csv(path, storage_options=dict(expand=True))
gcs_df = pd.read_csv(path.replace("*", "000000000000"))

pd.testing.assert_series_equal(
gcs_df["int64_col"].astype(pd.Int64Dtype()),
Expand Down

0 comments on commit 7b00656

Please sign in to comment.