Skip to content

Commit

Permalink
fix: renable to_csv and to_json related tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chelsea-lin committed Mar 20, 2024
1 parent 4fbf938 commit d7ce449
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
12 changes: 8 additions & 4 deletions tests/system/small/test_dataframe_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def test_to_pandas_batches_w_correct_dtypes(scalars_df_default_index):
pd.testing.assert_series_equal(actual, expected)


@pytest.mark.skip(reason="Disable to unblock kokoro tests")
@pytest.mark.parametrize(
("index"),
[True, False],
Expand Down Expand Up @@ -154,6 +153,7 @@ def test_to_csv_index(
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 All @@ -164,7 +164,6 @@ def test_to_csv_index(
pd.testing.assert_frame_equal(gcs_df, scalars_pandas_df)


@pytest.mark.skip(reason="Disable to unblock kokoro tests")
def test_to_csv_tabs(
scalars_dfs: Tuple[bigframes.dataframe.DataFrame, pd.DataFrame],
gcs_folder: str,
Expand Down Expand Up @@ -194,6 +193,7 @@ def test_to_csv_tabs(
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 @@ -415,7 +415,6 @@ def test_to_json_index_invalid_lines(
scalars_df.to_json(path, index=index)


@pytest.mark.skip(reason="Disable to unblock kokoro tests")
@pytest.mark.parametrize(
("index"),
[True, False],
Expand All @@ -435,7 +434,12 @@ def test_to_json_index_records_orient(
""" Test the `to_json` API with `orient` is `records` and `lines` is True"""
scalars_df.to_json(path, index=index, orient="records", lines=True)

gcs_df = pd.read_json(path, lines=True, convert_dates=["datetime_col"])
gcs_df = pd.read_json(
path,
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:
gcs_df = gcs_df.set_index(scalars_df.index.name)
Expand Down
6 changes: 2 additions & 4 deletions tests/system/small/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -2390,11 +2390,10 @@ def test_to_frame(scalars_dfs):
assert_pandas_df_equal(bf_result, pd_result)


@pytest.mark.skip(reason="Disable to unblock kokoro tests")
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)
gcs_df = pd.read_json(path, lines=True, storage_options=dict(expand=True))

pd.testing.assert_series_equal(
gcs_df["int64_col"].astype(pd.Int64Dtype()),
Expand All @@ -2404,11 +2403,10 @@ def test_to_json(gcs_folder, scalars_df_index, scalars_pandas_df_index):
)


@pytest.mark.skip(reason="Disable to unblock kokoro tests")
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)
gcs_df = pd.read_csv(path, storage_options=dict(expand=True))

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

0 comments on commit d7ce449

Please sign in to comment.