Skip to content

Commit 12e57cf

Browse files
committed
update test
1 parent 69d3c66 commit 12e57cf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pandas/tests/test_algos.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,11 +1260,17 @@ def test_value_counts_datetime_outofbounds(self, dtype):
12601260
],
12611261
dtype=dtype,
12621262
)
1263-
res = ser.value_counts()
1263+
1264+
warn = FutureWarning if dtype == object else None
1265+
msg = "The behavior of value_counts with object-dtype is deprecated"
1266+
with tm.assert_produces_warning(warn, match=msg):
1267+
res = ser.value_counts()
12641268

12651269
exp_index = Index(
12661270
[datetime(3000, 1, 1), datetime(5000, 1, 1), datetime(6000, 1, 1)],
1267-
dtype=dtype,
1271+
# TODO(3.0): once the value_counts inference deprecation is enforced,
1272+
# this will be `dtype=dtype`
1273+
dtype="M8[us]",
12681274
)
12691275
exp = Series([3, 2, 1], index=exp_index, name="count")
12701276
tm.assert_series_equal(res, exp)

0 commit comments

Comments
 (0)