Skip to content

Commit 9f6ebc9

Browse files
committed
round tests
1 parent a4ef563 commit 9f6ebc9

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

pandas/tests/extension/base/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class TestMyDtype(BaseDtypeTests):
5454
BaseComparisonOpsTests,
5555
BaseOpsUtil,
5656
BaseUnaryOpsTests,
57+
BaseRoundingTests,
5758
)
5859
from pandas.tests.extension.base.printing import BasePrintingTests
5960
from pandas.tests.extension.base.reduce import ( # noqa: F401
@@ -86,6 +87,7 @@ class ExtensionTests(
8687
BaseArithmeticOpsTests,
8788
BaseComparisonOpsTests,
8889
BaseUnaryOpsTests,
90+
BaseRoundingTests,
8991
BasePrintingTests,
9092
BaseReduceTests,
9193
BaseReshapingTests,

pandas/tests/extension/base/ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,5 +267,5 @@ def test_unary_ufunc_dunder_equivalence(self, data, ufunc):
267267
class BaseRoundingTests:
268268
def test_round(self, data):
269269
result = pd.Series(data).round()
270-
expected = pd.Series([np.round(item) for item in data], dtype = self.dtype)
270+
expected = pd.Series(np.round(data), dtype = data.dtype)
271271
tm.assert_series_equal(result, expected)

pandas/tests/extension/test_masked.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,3 +433,12 @@ class TestParsing(base.BaseParsingTests):
433433

434434
class Test2DCompat(base.Dim2CompatTests):
435435
pass
436+
437+
class TestRounding(base.BaseRoundingTests):
438+
def test_round(self, data, request):
439+
if data.dtype == "boolean":
440+
mark = pytest.mark.xfail(
441+
reason="Cannot round boolean dtype"
442+
)
443+
request.node.add_marker(mark)
444+
super().test_round(data)

0 commit comments

Comments
 (0)