Skip to content

Commit a5b54c2

Browse files
committed
Skip some pandas tests on no-pandas test runs
1 parent 6aa78e7 commit a5b54c2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

patsy/util.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,8 @@ def pandas_Categorical_from_codes(codes, categories):
606606
return pandas.Categorical(codes, categories)
607607

608608
def test_pandas_Categorical_from_codes():
609+
if not have_pandas_categorical:
610+
return
609611
c = pandas_Categorical_from_codes([1, 1, 0, -1], ["a", "b"])
610612
assert np.all(np.asarray(c)[:-1] == ["b", "b", "a"])
611613
assert np.isnan(np.asarray(c)[-1])
@@ -635,6 +637,8 @@ def pandas_Categorical_codes(cat):
635637
return cat.labels
636638

637639
def test_pandas_Categorical_accessors():
640+
if not have_pandas_categorical:
641+
return
638642
c = pandas_Categorical_from_codes([1, 1, 0, -1], ["a", "b"])
639643
assert np.all(pandas_Categorical_categories(c) == ["a", "b"])
640644
assert np.all(pandas_Categorical_codes(c) == [1, 1, 0, -1])

0 commit comments

Comments
 (0)