Skip to content

Commit

Permalink
test roundtripping of dempty dataframe (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd authored Jan 19, 2024
1 parent ba930ba commit 0000f23
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pantab/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def get_basic_dataframe():
"int64_limits": np.int64,
"float32_limits": np.float64,
"float64_limits": np.float64,
"non-ascii": "object",
"non-ascii": "string",
}
)

Expand Down
13 changes: 13 additions & 0 deletions pantab/tests/test_roundtrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,16 @@ def test_multiple_tables(df, roundtripped, tmp_hyper, table_name, table_mode):
assert set(result.keys()) == set((table_name, TableName("public", "table2")))
for val in result.values():
tm.assert_frame_equal(val, expected)


def test_empty_roundtrip(df, roundtripped, tmp_hyper, table_name, table_mode):
# object case is by definition vague, so lets punt that for now
df = df.drop(columns=["object"])
empty = df.iloc[:0]
pantab.frame_to_hyper(empty, tmp_hyper, table=table_name, table_mode=table_mode)
pantab.frame_to_hyper(empty, tmp_hyper, table=table_name, table_mode=table_mode)
result = pantab.frame_from_hyper(tmp_hyper, table=table_name)

expected = roundtripped.iloc[:0]
expected = expected.drop(columns=["object"])
tm.assert_frame_equal(result, expected)

0 comments on commit 0000f23

Please sign in to comment.