Skip to content

Commit 1acb00c

Browse files
undo testing changes for old pyarrow versions
1 parent cd26110 commit 1acb00c

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

pandas/tests/io/test_parquet.py

+28-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,23 @@ def engine(request):
4444
def pa():
4545
if not _HAVE_PYARROW:
4646
pytest.skip("pyarrow is not installed")
47-
if LooseVersion(pyarrow.__version__) < '0.7.0':
47+
return 'pyarrow'
48+
49+
50+
@pytest.fixture
51+
def pa_lt_070():
52+
if not _HAVE_PYARROW:
53+
pytest.skip("pyarrow is not installed")
54+
if LooseVersion(pyarrow.__version__) >= LooseVersion('0.7.0'):
55+
pytest.skip("pyarrow is >= 0.7.0")
56+
return 'pyarrow'
57+
58+
59+
@pytest.fixture
60+
def pa_ge_070():
61+
if not _HAVE_PYARROW:
62+
pytest.skip("pyarrow is not installed")
63+
if LooseVersion(pyarrow.__version__) < LooseVersion('0.7.0'):
4864
pytest.skip("pyarrow is < 0.7.0")
4965
return 'pyarrow'
5066

@@ -53,8 +69,6 @@ def pa():
5369
def fp():
5470
if not _HAVE_FASTPARQUET:
5571
pytest.skip("fastparquet is not installed")
56-
if LooseVersion(fastparquet.__version__) < '0.1.0':
57-
pytest.skip("fastparquet is < 0.1.0")
5872
return 'fastparquet'
5973

6074

@@ -394,13 +408,23 @@ def test_unsupported(self, pa):
394408
df = pd.DataFrame({'a': ['a', 1, 2.0]})
395409
self.check_error_on_write(df, pa, ValueError)
396410

397-
def test_categorical(self, pa):
411+
def test_categorical(self, pa_ge_070):
412+
pa = pa_ge_070
413+
414+
# supported in >= 0.7.0
398415
df = pd.DataFrame({'a': pd.Categorical(list('abc'))})
399416

400417
# de-serialized as object
401418
expected = df.assign(a=df.a.astype(object))
402419
self.check_round_trip(df, pa, expected)
403420

421+
def test_categorical_unsupported(self, pa_lt_070):
422+
pa = pa_lt_070
423+
424+
# supported in >= 0.7.0
425+
df = pd.DataFrame({'a': pd.Categorical(list('abc'))})
426+
self.check_error_on_write(df, pa, NotImplementedError)
427+
404428

405429
class TestParquetFastParquet(Base):
406430

0 commit comments

Comments
 (0)