Skip to content

Commit 9c9d5fb

Browse files
hussaintamboliTomAugspurger
authored andcommitted
Test for #16726. unittest that ensures datetime is understood (#16744)
* Test for #16726. unittest that ensures datetime is understood * Corrected the test as suggested by @TomAugspurger * Fixed flake8 errors and warnings
1 parent 18f7b1c commit 9c9d5fb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/series/test_datetime_values.py

+10
Original file line numberDiff line numberDiff line change
@@ -409,3 +409,13 @@ def test_date_tz(self):
409409
date(2015, 11, 22)])
410410
assert_series_equal(s.dt.date, expected)
411411
assert_series_equal(s.apply(lambda x: x.date()), expected)
412+
413+
def test_datetime_understood(self):
414+
# Ensures it doesn't fail to create the right series
415+
# reported in issue#16726
416+
series = pd.Series(pd.date_range("2012-01-01", periods=3))
417+
offset = pd.offsets.DateOffset(days=6)
418+
result = series - offset
419+
expected = pd.Series(pd.to_datetime([
420+
'2011-12-26', '2011-12-27', '2011-12-28']))
421+
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)