Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Skip some pandas tests on no-pandas test runs
  • Loading branch information
njsmith committed Oct 26, 2016
1 parent 6aa78e7 commit a5b54c2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions patsy/util.py
Expand Up @@ -606,6 +606,8 @@ def pandas_Categorical_from_codes(codes, categories):
return pandas.Categorical(codes, categories)

def test_pandas_Categorical_from_codes():
if not have_pandas_categorical:
return
c = pandas_Categorical_from_codes([1, 1, 0, -1], ["a", "b"])
assert np.all(np.asarray(c)[:-1] == ["b", "b", "a"])
assert np.isnan(np.asarray(c)[-1])
Expand Down Expand Up @@ -635,6 +637,8 @@ def pandas_Categorical_codes(cat):
return cat.labels

def test_pandas_Categorical_accessors():
if not have_pandas_categorical:
return
c = pandas_Categorical_from_codes([1, 1, 0, -1], ["a", "b"])
assert np.all(pandas_Categorical_categories(c) == ["a", "b"])
assert np.all(pandas_Categorical_codes(c) == [1, 1, 0, -1])
Expand Down

0 comments on commit a5b54c2

Please sign in to comment.