Skip to content

Commit d761c9c

Browse files
committed
update tests
1 parent c8cb33d commit d761c9c

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

pandas/core/dtypes/cast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ def maybe_infer_to_datetimelike(
11911191
# numpy would have done it for us.
11921192
convert_numeric=False,
11931193
convert_non_numeric=True,
1194-
dtype_if_all_nat=np.dtype("M8[ns]"),
1194+
dtype_if_all_nat=np.dtype("M8[s]"),
11951195
)
11961196

11971197

pandas/tests/indexes/datetimes/test_date_range.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ def test_date_range_edges(self, freq):
185185
[ts + n * td for n in range(1, 5)],
186186
dtype="M8[ns]",
187187
freq=freq,
188+
dtype="M8[ns]",
188189
)
189190
tm.assert_index_equal(idx, exp)
190191

pandas/tests/indexes/test_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def test_constructor_int_dtype_nan(self):
177177
"klass,dtype,na_val",
178178
[
179179
(Index, np.float64, np.nan),
180-
(DatetimeIndex, "datetime64[ns]", pd.NaT),
180+
(DatetimeIndex, "datetime64[s]", pd.NaT),
181181
],
182182
)
183183
def test_index_ctor_infer_nan_nat(self, klass, dtype, na_val):

pandas/tests/indexes/test_index_new.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ def test_constructor_infer_nat_dt_like(
141141
)
142142

143143
expected = klass([NaT, NaT])
144+
if dtype[0] == "d":
145+
# we infer all-NaT as second resolution
146+
expected = expected.astype("M8[ns]")
144147
assert expected.dtype == dtype
145148
data = [ctor]
146149
data.insert(pos, nulls_fixture)

pandas/tests/tools/test_to_datetime.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,7 +1568,7 @@ def test_to_datetime_cache_scalar(self):
15681568
(
15691569
(None, np.nan) + (NaT,) * start_caching_at,
15701570
(NaT,) * (start_caching_at + 2),
1571-
"ns",
1571+
"s",
15721572
),
15731573
(
15741574
(None, Timestamp("2012-07-26")) + (NaT,) * start_caching_at,
@@ -1618,7 +1618,7 @@ def test_convert_object_to_datetime_with_cache(
16181618
)
16191619
def test_to_datetime_converts_null_like_to_nat(self, cache, input):
16201620
# GH35888
1621-
expected = Series([NaT] * len(input), dtype="M8[ns]")
1621+
expected = Series([NaT] * len(input), dtype="M8[s]")
16221622
result = to_datetime(input, cache=cache)
16231623
tm.assert_series_equal(result, expected)
16241624

@@ -3186,7 +3186,7 @@ def test_na_values_with_cache(
31863186
self, cache, unique_nulls_fixture, unique_nulls_fixture2
31873187
):
31883188
# GH22305
3189-
expected = Index([NaT, NaT], dtype="datetime64[ns]")
3189+
expected = Index([NaT, NaT], dtype="datetime64[s]")
31903190
result = to_datetime([unique_nulls_fixture, unique_nulls_fixture2], cache=cache)
31913191
tm.assert_index_equal(result, expected)
31923192

0 commit comments

Comments
 (0)