Skip to content

Commit fd6c695

Browse files
committed
update tests
1 parent 865876e commit fd6c695

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

pandas/tests/tools/test_to_datetime.py

+2-16
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ def test_out_of_bounds_errors_ignore2(self):
12111211
msg = "errors='ignore' is deprecated"
12121212
with tm.assert_produces_warning(FutureWarning, match=msg):
12131213
res = to_datetime(Series(["2362-01-01", np.nan]), errors="ignore")
1214-
exp = Series(["2362-01-01", np.nan], dtype=object)
1214+
exp = Series(["2362-01-01", np.nan], dtype="M8[s]")
12151215
tm.assert_series_equal(res, exp)
12161216

12171217
def test_to_datetime_tz(self, cache):
@@ -2955,11 +2955,7 @@ def test_infer_datetime_format_tz_name(self, tz_name, offset):
29552955
result = to_datetime(ser)
29562956
tz = timezone(timedelta(minutes=offset))
29572957
expected = Series([Timestamp("2019-02-02 08:07:13").tz_localize(tz)])
2958-
# TODO: not great that we get different units here
2959-
if offset == 0:
2960-
expected = expected.dt.as_unit("s")
2961-
else:
2962-
expected = expected.dt.as_unit("us")
2958+
expected = expected.dt.as_unit("s")
29632959
tm.assert_series_equal(result, expected)
29642960

29652961
@pytest.mark.parametrize(
@@ -3141,11 +3137,6 @@ def test_parsers(self, date_str, expected, cache):
31413137
date_str, yearfirst=yearfirst
31423138
)
31433139

3144-
# FIXME: in these cases reso_attrname is coming back as "microsecond"
3145-
# instead of "second". The array_strptime paths get these right, but
3146-
# the DatetimeIndex (array_to_datetime) and Timestamp constructors do not.
3147-
is_broken = date_str in ["2005/11/09 10:15:32 AM", "Thu Sep 25 10:36:28 2003"]
3148-
31493140
reso = {
31503141
"nanosecond": "ns",
31513142
"microsecond": "us",
@@ -3168,18 +3159,13 @@ def test_parsers(self, date_str, expected, cache):
31683159
for res in [result3, result4]:
31693160
exp = DatetimeIndex([Timestamp(expected)])
31703161
exp = exp.as_unit(reso)
3171-
if is_broken:
3172-
exp = exp.as_unit("s")
31733162
tm.assert_index_equal(res, exp)
31743163

31753164
for res in [result6, result8, result9]:
31763165
# These cases go through array_to_datetime, not array_to_strptime.
31773166
# This means that as of GH#??? they do resolution inference
31783167
# while the other cases do not.
31793168
exp = DatetimeIndex([Timestamp(expected)]).as_unit(reso)
3180-
if is_broken:
3181-
# FIXME: should be "s"
3182-
exp = exp.as_unit("us")
31833169
tm.assert_index_equal(res, exp)
31843170

31853171
# these really need to have yearfirst, but we don't support

pandas/tests/tseries/holiday/test_calendar.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ def __init__(self, name=None, rules=None) -> None:
5757
jan2 = TestCalendar(rules=[Holiday("jan2", year=2015, month=1, day=2)])
5858

5959
# Getting holidays for Jan 1 should not alter results for Jan 2.
60-
expected = DatetimeIndex(["01-Jan-2015"]).as_unit("ns")
60+
expected = DatetimeIndex(["01-Jan-2015"]).as_unit("us")
6161
tm.assert_index_equal(jan1.holidays(), expected)
6262

63-
expected2 = DatetimeIndex(["02-Jan-2015"]).as_unit("ns")
63+
expected2 = DatetimeIndex(["02-Jan-2015"]).as_unit("us")
6464
tm.assert_index_equal(jan2.holidays(), expected2)
6565

6666

0 commit comments

Comments
 (0)