From 61888b20bd9a0eedafefd3c2196879e83d0dc1f8 Mon Sep 17 00:00:00 2001 From: Galuh Sahid Date: Tue, 20 Aug 2019 00:30:21 +0700 Subject: [PATCH] TST: Update pyarrow tests to test parquet faithful roundtrip for Categorical support Fixes #27955 --- pandas/tests/io/test_parquet.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pandas/tests/io/test_parquet.py b/pandas/tests/io/test_parquet.py index d634859e72d7b..938dfa7945fca 100644 --- a/pandas/tests/io/test_parquet.py +++ b/pandas/tests/io/test_parquet.py @@ -1,5 +1,6 @@ """ test parquet compat """ import datetime +from distutils.version import LooseVersion import os from warnings import catch_warnings @@ -166,6 +167,7 @@ def compare(repeat): df.to_parquet(path, **write_kwargs) with catch_warnings(record=True): actual = read_parquet(path, **read_kwargs) + tm.assert_frame_equal(expected, actual, check_names=check_names) if path is None: @@ -453,9 +455,12 @@ def test_categorical(self, pa): # supported in >= 0.7.0 df = pd.DataFrame({"a": pd.Categorical(list("abc"))}) - # de-serialized as object - expected = df.assign(a=df.a.astype(object)) - check_round_trip(df, pa, expected=expected) + if LooseVersion(pyarrow.__version__) >= LooseVersion("0.15.0"): + check_round_trip(df, pa) + else: + # de-serialized as object for pyarrow < 0.15 + expected = df.assign(a=df.a.astype(object)) + check_round_trip(df, pa, expected=expected) def test_s3_roundtrip(self, df_compat, s3_resource, pa): # GH #19134