Skip to content

Commit

Permalink
TST: Add test for non-json serializable attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
snowman2 committed Jun 2, 2021
1 parent 0221b26 commit 564793e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pandas/tests/io/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,17 @@ def test_read_write_attrs(self, pa):
}
assert result.b.attrs == {}

@td.skip_if_no("pyarrow")
def test_read_write_attrs__invalid(self, pa):
df = pd.DataFrame({"a": [1], "b": [1]})
df.attrs = {-1: np.array(1)}
df.a.attrs = {-1: np.array(1)}
df.b.attrs = {}
with tm.ensure_clean() as path, pytest.raises(
TypeError, match="not JSON serializable"
):
df.to_parquet(path)


class TestParquetFastParquet(Base):
def test_basic(self, fp, df_full):
Expand Down

0 comments on commit 564793e

Please sign in to comment.