Skip to content

Commit f759ce2

Browse files
committed
fix: allow comparison with scalar values
1 parent 9801e8b commit f759ce2

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed

tests/compliance/conftest.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,23 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import operator
16+
1517
import pandas
1618
import pytest
1719

1820

21+
@pytest.fixture(params=[True, False])
22+
def as_array(request):
23+
"""
24+
Boolean fixture to support ExtensionDtype _from_sequence method testing.
25+
26+
See:
27+
https://github.com/pandas-dev/pandas/blob/main/pandas/tests/extension/conftest.py
28+
"""
29+
return request.param
30+
31+
1932
@pytest.fixture(params=[True, False])
2033
def as_frame(request):
2134
"""
@@ -38,6 +51,36 @@ def as_series(request):
3851
return request.param
3952

4053

54+
@pytest.fixture(params=[True, False])
55+
def box_in_series(request):
56+
"""
57+
Whether to box the data in a Series
58+
59+
See:
60+
https://github.com/pandas-dev/pandas/blob/main/pandas/tests/extension/conftest.py
61+
"""
62+
return request.param
63+
64+
65+
@pytest.fixture(
66+
params=[
67+
operator.eq,
68+
operator.ne,
69+
operator.gt,
70+
operator.ge,
71+
operator.lt,
72+
operator.le,
73+
]
74+
)
75+
def comparison_op(request):
76+
"""
77+
Fixture for operator module comparison functions.
78+
79+
See: https://github.com/pandas-dev/pandas/blob/main/pandas/conftest.py
80+
"""
81+
return request.param
82+
83+
4184
@pytest.fixture(params=["ffill", "bfill"])
4285
def fillna_method(request):
4386
"""
@@ -50,6 +93,25 @@ def fillna_method(request):
5093
return request.param
5194

5295

96+
@pytest.fixture(
97+
params=[
98+
lambda x: 1,
99+
lambda x: [1] * len(x),
100+
lambda x: pandas.Series([1] * len(x)),
101+
lambda x: x,
102+
],
103+
ids=["scalar", "list", "series", "object"],
104+
)
105+
def groupby_apply_op(request):
106+
"""
107+
Functions to test groupby.apply().
108+
109+
See:
110+
https://github.com/pandas-dev/pandas/blob/main/pandas/tests/extension/conftest.py
111+
"""
112+
return request.param
113+
114+
53115
@pytest.fixture
54116
def invalid_scalar(data):
55117
"""

tests/compliance/date/test_date_compliance.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,27 @@ def test_value_counts(self, all_data, dropna):
7474
expected = pandas.Series(other).value_counts(dropna=dropna).sort_index()
7575

7676
self.assert_series_equal(result, expected)
77+
78+
79+
class TestCasting(base.BaseCastingTests):
80+
pass
81+
82+
83+
class TestGroupby(base.BaseGroupbyTests):
84+
pass
85+
86+
87+
class TestSetitem(base.BaseSetitemTests):
88+
pass
89+
90+
91+
class TestPrinting(base.BasePrintingTests):
92+
pass
93+
94+
95+
# TODO(https://github.com/googleapis/python-db-dtypes-pandas/issues/78): Add
96+
# compliance tests for arithmetic operations.
97+
98+
99+
class TestComparisonOps(base.BaseComparisonOpsTests):
100+
pass

0 commit comments

Comments
 (0)