Skip to content

Commit 495f62f

Browse files
committed
more fixups
1 parent a090549 commit 495f62f

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

pandas/tests/dtypes/test_generic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
class TestABCClasses:
1919
tuples = [[1, 2, 2], ["red", "blue", "red"]]
2020
multi_index = pd.MultiIndex.from_arrays(tuples, names=("number", "color"))
21-
datetime_index = pd.to_datetime(["1/1/2000", "1/1/2010"])
21+
datetime_index = pd.to_datetime(["2000/1/1", "2010/1/1"])
2222
timedelta_index = pd.to_timedelta(np.arange(5), unit="s")
2323
period_index = pd.period_range("1/1/2000", "1/1/2010", freq="M")
2424
categorical = pd.Categorical([1, 2, 3], categories=[2, 3, 1])

pandas/tests/frame/methods/test_reset_index.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -337,19 +337,24 @@ def test_reset_index_multiindex_nan(self):
337337
tm.assert_frame_equal(rs, df)
338338

339339
@pytest.mark.parametrize(
340-
"name, warn",
340+
"name",
341341
[
342-
(None, UserWarning),
343-
("foo", UserWarning),
344-
(2, None),
345-
(3.0, None),
346-
(pd.Timedelta(6), None),
347-
(Timestamp("2012-12-30", tz="UTC"), FutureWarning),
348-
("2012-12-31", None),
342+
None,
343+
"foo",
344+
2,
345+
3.0,
346+
pd.Timedelta(6),
347+
Timestamp("2012-12-30", tz="UTC"),
348+
"2012-12-31",
349349
],
350350
)
351-
def test_reset_index_with_datetimeindex_cols(self, name, warn):
351+
def test_reset_index_with_datetimeindex_cols(self, name):
352352
# GH#5818
353+
warn = None
354+
if isinstance(name, Timestamp) and name.tz is not None:
355+
# _deprecate_mismatched_indexing
356+
warn = FutureWarning
357+
353358
df = DataFrame(
354359
[[1, 2], [3, 4]],
355360
columns=date_range("1/1/2013", "1/2/2013"),

pandas/tests/tslibs/test_array_to_datetime.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,17 +166,11 @@ def test_coerce_of_invalid_datetimes(errors):
166166
if errors == "ignore":
167167
# Without coercing, the presence of any invalid
168168
# dates prevents any values from being converted.
169-
with tm.assert_produces_warning(
170-
UserWarning, match="without a format specified"
171-
):
172-
result, _ = tslib.array_to_datetime(**kwargs)
169+
result, _ = tslib.array_to_datetime(**kwargs)
173170
tm.assert_numpy_array_equal(result, arr)
174171
else: # coerce.
175172
# With coercing, the invalid dates becomes iNaT
176-
with tm.assert_produces_warning(
177-
UserWarning, match="without a format specified"
178-
):
179-
result, _ = tslib.array_to_datetime(arr, errors="coerce")
173+
result, _ = tslib.array_to_datetime(arr, errors="coerce")
180174
expected = ["2013-01-01T00:00:00.000000000", iNaT, iNaT]
181175

182176
tm.assert_numpy_array_equal(result, np.array(expected, dtype="M8[ns]"))

0 commit comments

Comments
 (0)