Skip to content

Commit cfc53ae

Browse files
committed
TST: Add test for null, out-of-order values, and unobserved category
Closes #27955
1 parent ab9b082 commit cfc53ae

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pandas/tests/io/test_parquet.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,12 @@ def test_unsupported(self, pa):
453453
def test_categorical(self, pa):
454454

455455
# supported in >= 0.7.0
456-
df = pd.DataFrame({"a": pd.Categorical(list("abc"))})
456+
df = pd.DataFrame()
457+
df["a"] = pd.Categorical(list("abcdef"))
458+
459+
# test for null, out-of-order values, and unobserved category
460+
dtype = pd.CategoricalDtype(["foo", "bar", "baz"])
461+
df["b"] = pd.Categorical.from_codes(codes=[1, 0, 0, 1, -1, 1], dtype=dtype)
457462

458463
if LooseVersion(pyarrow.__version__) >= LooseVersion("0.15.0"):
459464
check_round_trip(df, pa)

0 commit comments

Comments
 (0)