Skip to content

Commit 8452080

Browse files
authored
COMPAT: xarray 0.8.2 test compat w.r.t. CategoricalIndex indempotency (pandas-dev#15285)
closes pandas-dev#15282
1 parent 48fc9d6 commit 8452080

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

ci/install_travis.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ else
143143
echo "[pip installs]"
144144
REQ="ci/requirements-${PYTHON_VERSION}${JOB_TAG}.pip"
145145
if [ -e ${REQ} ]; then
146-
pip install --upgrade -r $REQ
146+
pip install -r $REQ
147147
fi
148148

149149
# may have addtl installation instructions for this build

ci/requirements-2.7.run

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ html5lib=1.0b2
2020
beautiful-soup=4.2.1
2121
statsmodels
2222
jinja2=2.8
23-
xarray
23+
xarray=0.8.0

ci/requirements-3.5.pip

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
xarray==0.9.1

ci/requirements-3.5.run

-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@ bottleneck
1616
sqlalchemy
1717
pymysql
1818
psycopg2
19-
xarray
2019
s3fs
2120
beautifulsoup4

pandas/tests/test_generic.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from numpy import nan
88
import pandas as pd
99

10+
from distutils.version import LooseVersion
1011
from pandas.types.common import is_scalar
1112
from pandas import (Index, Series, DataFrame, Panel, isnull,
1213
date_range, period_range, Panel4D)
@@ -870,6 +871,7 @@ def test_describe_none(self):
870871
def test_to_xarray(self):
871872

872873
tm._skip_if_no_xarray()
874+
import xarray
873875
from xarray import DataArray
874876

875877
s = Series([])
@@ -895,15 +897,16 @@ def testit(index, check_index_type=True, check_categorical=True):
895897
check_index_type=check_index_type,
896898
check_categorical=check_categorical)
897899

898-
for index in [tm.makeFloatIndex, tm.makeIntIndex,
899-
tm.makeStringIndex, tm.makeUnicodeIndex,
900-
tm.makeDateIndex, tm.makePeriodIndex,
901-
tm.makeTimedeltaIndex]:
902-
testit(index)
900+
l = [tm.makeFloatIndex, tm.makeIntIndex,
901+
tm.makeStringIndex, tm.makeUnicodeIndex,
902+
tm.makeDateIndex, tm.makePeriodIndex,
903+
tm.makeTimedeltaIndex]
904+
905+
if LooseVersion(xarray.__version__) >= '0.8.0':
906+
l.append(tm.makeCategoricalIndex)
903907

904-
# not idempotent
905-
testit(tm.makeCategoricalIndex, check_index_type=False,
906-
check_categorical=False)
908+
for index in l:
909+
testit(index)
907910

908911
s = Series(range(6))
909912
s.index.name = 'foo'

0 commit comments

Comments
 (0)