Skip to content
This repository was archived by the owner on Jun 10, 2022. It is now read-only.

Commit 704d7da

Browse files
committed
0.19.2 compat
1 parent 2c53635 commit 704d7da

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

pandas_compat/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,26 @@
1919
# >= 0.20.0
2020
if not _pd_version_under_020:
2121
from pandas.api.types import * # noqa
22+
from pandas.util import hash_pandas_object, hash_array # noqa
2223

2324
# >= 0.19.0
2425
elif not _pd_version_under_019:
26+
from pandas.lib import infer_dtype, isscalar as is_scalar # noqa
2527
from pandas.api.types import * # noqa
2628
from pandas.types.dtypes import * # noqa
29+
from pandas.types.concat import union_categoricals # noqa
30+
from pandas.tools.hashing import hash_pandas_object, hash_array # noqa
2731

2832
# >= 0.18.0
2933
elif not _pd_version_under_018:
34+
from pandas.lib import infer_dtype, isscalar as is_scalar # noqa
3035
from pandas.core.common import * # noqa
3136

3237
# >= 0.17.0
3338
elif not _pd_version_under_017:
39+
from pandas.lib import infer_dtype, isscalar as is_scalar # noqa
3440
from pandas.core.common import * # noqa
3541

36-
else:
37-
raise ValueError("pandas < 0.17.0 is not supported for pandas-compat")
38-
3942

4043
versions = get_versions()
4144
__version__ = versions.get('closest-tag', versions['version'])

tests/test_compat.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
pytest.importorskip("pandas", minversion="0.17.0")
1212

1313

14+
# 017
1415
@pytest.mark.parametrize("func", [
1516
'is_bool', 'is_bool_dtype',
1617
'is_categorical', 'is_categorical_dtype', 'is_complex',
@@ -24,12 +25,20 @@
2425
'is_timedelta64_dtype', 'is_timedelta64_ns_dtype',
2526
'is_re', 'is_re_compilable',
2627
'is_iterator',
27-
'is_list_like', 'is_hashable'])
28+
'is_list_like', 'is_hashable', 'infer_dtype', 'is_scalar'])
2829
def test_introspection_017(func):
2930
result = getattr(pdc, func)
3031
assert result is not None
3132

3233

34+
@pytest.mark.parametrize("dtype", [
35+
'CategoricalDtype',
36+
'DatetimeTZDtype'])
37+
def test_dtypes_017(dtype):
38+
result = getattr(pdc, dtype)
39+
assert result is not None
40+
41+
3342
# 018
3443
@pytest.mark.skipif(
3544
pdc._pd_version_under_018, reason='pandas >= 0.18.0 required')
@@ -45,8 +54,10 @@ def test_introspection_018(func):
4554
@pytest.mark.skipif(
4655
pdc._pd_version_under_019, reason='pandas >= 0.19.0 required')
4756
@pytest.mark.parametrize("func", [
48-
'is_scalar', 'is_file_like', 'is_period',
49-
'union_categoricals', 'infer_dtype'])
57+
'is_period',
58+
'union_categoricals',
59+
'hash_array',
60+
'hash_pandas_object'])
5061
def test_introspection_019(func):
5162
result = getattr(pdc, func)
5263
assert result is not None
@@ -56,25 +67,15 @@ def test_introspection_019(func):
5667
@pytest.mark.skipif(
5768
pdc._pd_version_under_020, reason='pandas >= 0.20.0 required')
5869
@pytest.mark.parametrize("func", [
59-
'is_interval', 'is_interval_dtype', 'is_period_dtype',
70+
'is_interval', 'is_file_like', 'is_interval_dtype', 'is_period_dtype',
6071
'is_signed_integer_dtype', 'is_unsigned_integer_dtype'])
6172
def test_introspection_020(func):
6273
result = getattr(pdc, func)
6374
assert result is not None
6475

6576

66-
# 017
67-
@pytest.mark.parametrize("dtype", [
68-
'CategoricalDtype',
69-
'DatetimeTZDtype'])
70-
def test_dtypes_017(dtype):
71-
result = getattr(pdc, dtype)
72-
assert result is not None
73-
74-
75-
# 020
7677
@pytest.mark.skipif(
77-
pdc._pd_version_under_019, reason='pandas >= 0.19.0 required')
78+
pdc._pd_version_under_020, reason='pandas >= 0.20.0 required')
7879
@pytest.mark.parametrize("dtype", [
7980
'IntervalDtype',
8081
'PeriodDtype'])

0 commit comments

Comments
 (0)