Skip to content

Commit 65109ef

Browse files
committed
add test for non-nestable struct
1 parent b213ff1 commit 65109ef

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

tests/nested_pandas/nestedframe/test_io.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ def test_read_parquet_column_selection(columns):
5858
assert nf.nested.nest.fields == ["band"]
5959
assert nf.lincc.nest.fields == ["band"]
6060

61-
62-
def test_read_parquet_reject_nesting():
61+
@pytest.mark.parametrize("reject", [["nested"], "nested"])
62+
def test_read_parquet_reject_nesting(reject):
6363
"""Test reading a parquet file with column selection"""
6464
# Load in the example file
6565
nf = read_parquet("tests/test_data/nested.parquet",
6666
columns=["a", "nested"],
67-
reject_nesting=["nested"])
67+
reject_nesting=reject)
6868

6969
# Check the columns
7070
assert nf.columns.tolist() == ["a", "nested"]
@@ -93,6 +93,13 @@ def test_read_parquet_catch_full_and_partial():
9393
read_parquet("tests/test_data/nested.parquet", columns=["a", "nested.t", "nested"])
9494

9595

96+
def test_read_parquet_catch_failed_cast():
97+
"""Test reading a parquet file with column selection"""
98+
# Load in the example file
99+
with pytest.raises(ValueError):
100+
read_parquet("tests/test_data/not_nestable.parquet")
101+
102+
96103
def test_to_parquet():
97104
"""Test writing a parquet file with no columns specified"""
98105
# Load in the example file
1.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)