Skip to content

Commit 54463ee

Browse files
authored
Add ExtensionArray to array_like (#229)
1 parent 80553d6 commit 54463ee

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

gemd/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.2.3"
1+
__version__ = "2.2.4"

gemd/entity/util.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ def array_like():
8888
import numpy as np
8989
try:
9090
import pandas as pd
91-
_array_like = (list, tuple, np.ndarray, pd.core.base.PandasObject)
91+
_array_like = (list, tuple, np.ndarray,
92+
pd.core.base.PandasObject,
93+
pd.api.extensions.ExtensionArray)
9294
except ImportError: # pragma: no cover
9395
_array_like = (list, tuple, np.ndarray) # pragma: no cover
9496
except ImportError: # pragma: no cover

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ exclude = ["docs", "tests"]
4747
dev = [
4848
"flake8==7.0.0",
4949
"flake8-docstrings==1.7.0",
50-
"numpy==1.24.4; python_version<'3.10'",
51-
"pandas==2.0.3; python_version<'3.10'",
52-
"numpy>=2.0.2,<=2.1.0; python_version>='3.10'",
53-
"pandas==2.3.0; python_version>='3.10'",
50+
"numpy>=1.24.4; python_version<'3.10'",
51+
"pandas>=2.0.3; python_version<'3.10'",
52+
"numpy>=2.0.2,<3; python_version>='3.10'",
53+
"pandas>=2.3.0,<4; python_version>='3.10'",
5454
"pytest==8.4.2",
5555
"pytest-cov==7.0.0",
5656
"derp==0.1.1",

tests/entity/bounds/test_categorical_bounds.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def test_json():
6262

6363
def test_numpy():
6464
"""Test that ndarrays, Series work as well."""
65-
assert len(array_like()) < 5 # In case we extend at some point
65+
assert len(array_like()) < 6 # In case we extend at some point
6666

6767
if len(array_like()) > 2: # Test numpy
6868
import numpy as np
@@ -75,3 +75,6 @@ def test_numpy():
7575
pd_bounds = CategoricalBounds(pd.Series(["spam", "eggs"]))
7676
pd_copy = loads(dumps(pd_bounds))
7777
assert pd_copy == pd_bounds
78+
79+
pd_unique = CategoricalBounds(pd.Series(["spam", "eggs"]).unique())
80+
assert pd_copy == pd_unique

tests/entity/bounds/test_composition_bounds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def test_json():
6363

6464
def test_numpy():
6565
"""Test that ndarrays, Series work as well."""
66-
assert len(array_like()) < 5 # In case we extend at some point
66+
assert len(array_like()) < 6 # In case we extend at some point
6767

6868
if len(array_like()) > 2: # Test numpy
6969
import numpy as np

0 commit comments

Comments
 (0)