@@ -44,7 +44,23 @@ def engine(request):
44
44
def pa ():
45
45
if not _HAVE_PYARROW :
46
46
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' ):
48
64
pytest .skip ("pyarrow is < 0.7.0" )
49
65
return 'pyarrow'
50
66
@@ -53,8 +69,6 @@ def pa():
53
69
def fp ():
54
70
if not _HAVE_FASTPARQUET :
55
71
pytest .skip ("fastparquet is not installed" )
56
- if LooseVersion (fastparquet .__version__ ) < '0.1.0' :
57
- pytest .skip ("fastparquet is < 0.1.0" )
58
72
return 'fastparquet'
59
73
60
74
@@ -394,13 +408,23 @@ def test_unsupported(self, pa):
394
408
df = pd .DataFrame ({'a' : ['a' , 1 , 2.0 ]})
395
409
self .check_error_on_write (df , pa , ValueError )
396
410
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
398
415
df = pd .DataFrame ({'a' : pd .Categorical (list ('abc' ))})
399
416
400
417
# de-serialized as object
401
418
expected = df .assign (a = df .a .astype (object ))
402
419
self .check_round_trip (df , pa , expected )
403
420
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
+
404
428
405
429
class TestParquetFastParquet (Base ):
406
430
0 commit comments