22import tempfile
33
44import pandas as pd
5+ import pyarrow as pa
56import pytest
6- from nested_pandas import NestedFrame , read_parquet
7+ from nested_pandas import read_parquet
78from pandas .testing import assert_frame_equal
89
9- import pyarrow as pa
10-
1110
1211def test_read_parquet ():
1312 """Test reading a parquet file with no columns specified"""
@@ -25,12 +24,16 @@ def test_read_parquet():
2524 assert nf .lincc .nest .fields == ["band" , "frameworks" ]
2625
2726
28- @pytest .mark .parametrize ("columns" , [["a" , "flux" ],
29- ["flux" , "nested" , "lincc" ],
30- ["nested.flux" , "nested.band" ],
31- ["flux" , "nested.flux" ],
32- ["nested.band" , "lincc.band" ],
33- ])
27+ @pytest .mark .parametrize (
28+ "columns" ,
29+ [
30+ ["a" , "flux" ],
31+ ["flux" , "nested" , "lincc" ],
32+ ["nested.flux" , "nested.band" ],
33+ ["flux" , "nested.flux" ],
34+ ["nested.band" , "lincc.band" ],
35+ ],
36+ )
3437def test_read_parquet_column_selection (columns ):
3538 """Test reading a parquet file with column selection"""
3639 # Load in the example file
@@ -58,13 +61,12 @@ def test_read_parquet_column_selection(columns):
5861 assert nf .nested .nest .fields == ["band" ]
5962 assert nf .lincc .nest .fields == ["band" ]
6063
64+
6165@pytest .mark .parametrize ("reject" , [["nested" ], "nested" ])
6266def test_read_parquet_reject_nesting (reject ):
6367 """Test reading a parquet file with column selection"""
6468 # Load in the example file
65- nf = read_parquet ("tests/test_data/nested.parquet" ,
66- columns = ["a" , "nested" ],
67- reject_nesting = reject )
69+ nf = read_parquet ("tests/test_data/nested.parquet" , columns = ["a" , "nested" ], reject_nesting = reject )
6870
6971 # Check the columns
7072 assert nf .columns .tolist () == ["a" , "nested" ]
@@ -78,9 +80,7 @@ def test_read_parquet_reject_nesting(reject):
7880def test_read_parquet_reject_nesting_partial_loading ():
7981 """Test reading a parquet file with column selection"""
8082 # Load in the example file
81- nf = read_parquet ("tests/test_data/nested.parquet" ,
82- columns = ["a" , "nested.t" ],
83- reject_nesting = ["nested" ])
83+ nf = read_parquet ("tests/test_data/nested.parquet" , columns = ["a" , "nested.t" ], reject_nesting = ["nested" ])
8484
8585 # Check the columns
8686 assert nf .columns .tolist () == ["a" , "t" ]
0 commit comments