Skip to content

Commit 8b8969e

Browse files
committed
TST: test that we work in downstream packages
1 parent a31c96d commit 8b8969e

7 files changed

+136
-1
lines changed

ci/requirements-2.7.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
source activate pandas
44

5-
echo "install 27"
5+
echo "install 27 BUILD_TEST"
66

77
conda install -n pandas -c conda-forge feather-format

ci/requirements-2.7_BUILD_TEST.pip

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
xarray
2+
geopandas
3+
dask
4+
toolz
5+
seaborn
6+
pandas_gbq
7+
pandas_datareader
8+
statsmodels
9+
scikit-learn

ci/requirements-2.7_BUILD_TEST.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
source activate pandas
4+
5+
echo "install 27"
6+
7+
conda install -n pandas -c conda-forge pyarrow

pandas/tests/test_downstream.py

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
"""
2+
Testing that we work in the downstream packages
3+
"""
4+
import pytest
5+
import numpy as np
6+
from pandas import DataFrame
7+
from pandas.util import testing as tm
8+
9+
10+
@pytest.fixture
11+
def df():
12+
return DataFrame({'A': [1, 2, 3]})
13+
14+
15+
def test_dask(df):
16+
17+
toolz = pytest.importorskip('toolz') # noqa
18+
dask = pytest.importorskip('dask') # noqa
19+
20+
import dask.dataframe as dd
21+
22+
ddf = dd.from_pandas(df)
23+
assert ddf.A is not None
24+
assert ddf.compute()
25+
26+
27+
def test_xarray(df):
28+
29+
xarray = pytest.importorskip('xarray') # noqa
30+
31+
assert df.to_xarray() is not None
32+
33+
34+
def test_statsmodels():
35+
36+
statsmodels = pytest.importorskip('statsmodels') # noqa
37+
import statsmodels.api as sm
38+
import statsmodels.formula.api as smf
39+
df = sm.datasets.get_rdataset("Guerry", "HistData").data
40+
smf.ols('Lottery ~ Literacy + np.log(Pop1831)', data=df).fit()
41+
42+
43+
def test_scikit_learn(df):
44+
45+
sklearn = pytest.importorskip('sklearn') # noqa
46+
from sklearn import svm, datasets
47+
48+
digits = datasets.load_digits()
49+
clf = svm.SVC(gamma=0.001, C=100.)
50+
clf.fit(digits.data[:-1], digits.target[:-1])
51+
clf.predict(digits.data[-1:])
52+
53+
54+
def test_seaborn():
55+
56+
seaborn = pytest.importorskip('seaborn')
57+
tips = seaborn.load_dataset("tips")
58+
seaborn.stripplot(x="day", y="total_bill", data=tips)
59+
60+
61+
def test_pandas_gbq(df):
62+
63+
pandas_gbq = pytest.importorskip('pandas-gbq') # noqa
64+
65+
66+
@tm.network
67+
def test_pandas_datareader():
68+
69+
pandas_datareader = pytest.importorskip('pandas-datareader') # noqa
70+
pandas_datareader.get_data_yahoo('AAPL')
71+
72+
73+
def test_geopandas():
74+
75+
geopandas = pytest.importorskip('geopandas') # noqa
76+
fp = geopandas.datasets.get_path('naturalearth_lowres')
77+
assert geopandas.read_file(fp) is not None
78+
79+
80+
def test_pyarrow(df):
81+
82+
pyarrow = pytest.importorskip('pyarrow') # noqa
83+
table = pyarrow.Table.from_pandas(df)
84+
result = table.to_pandas()
85+
tm.assert_frame_equal(result, df)

pandas/types/common.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import warnings
2+
3+
warnings.warn("pandas.types.common is deprecated and will be "
4+
"removed in a future version, import "
5+
"from pandas.api.types",
6+
DeprecationWarning, stacklevel=3)
7+
8+
from pandas.core.dtypes.common import *

pandas/util/decorators.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import warnings
2+
3+
warnings.warn("pandas.util.decorators is deprecated and will be "
4+
"removed in a future version, import "
5+
"from pandas.util",
6+
DeprecationWarning, stacklevel=3)
7+
8+
from pandas.util import cache_readonly

pandas/util/hashing.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import warnings
2+
import sys
3+
4+
m = sys.modules['pandas.util.hashing']
5+
for t in ['hash_pandas_object', 'hash_array']:
6+
7+
def outer(t=t):
8+
9+
def wrapper(*args, **kwargs):
10+
from pandas import util
11+
warnings.warn("pandas.util.hashing is deprecated and will be "
12+
"removed in a future version, import "
13+
"from pandas.util",
14+
DeprecationWarning, stacklevel=3)
15+
return getattr(util, t)(*args, **kwargs)
16+
return wrapper
17+
18+
setattr(m, t, outer(t))

0 commit comments

Comments
 (0)