Skip to content

Commit 40bf8ac

Browse files
committed
update tests
1 parent 31bbee1 commit 40bf8ac

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

pandas/tests/frame/methods/test_combine_first.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,15 @@ def test_combine_first_convert_datatime_correctly(
195195

196196
def test_combine_first_align_nan(self):
197197
# GH 7509 (not fixed)
198-
dfa = DataFrame([[pd.Timestamp("2011-01-01"), 2]], columns=["a", "b"])
198+
ts = pd.Timestamp("2011-01-01").as_unit("s")
199+
dfa = DataFrame([[ts, 2]], columns=["a", "b"])
199200
dfb = DataFrame([[4], [5]], columns=["b"])
200201
assert dfa["a"].dtype == "datetime64[s]"
201202
assert dfa["b"].dtype == "int64"
202203

203204
res = dfa.combine_first(dfb)
204205
exp = DataFrame(
205-
{"a": [pd.Timestamp("2011-01-01"), pd.NaT], "b": [2, 5]},
206+
{"a": [ts, pd.NaT], "b": [2, 5]},
206207
columns=["a", "b"],
207208
)
208209
tm.assert_frame_equal(res, exp)

pandas/tests/io/json/test_pandas.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ def test_frame_non_unique_index_raises(self, orient):
128128
[["a", "b"], ["c", "d"]],
129129
[[1.5, 2.5], [3.5, 4.5]],
130130
[[1, 2.5], [3, 4.5]],
131-
[[Timestamp("20130101"), 3.5], [Timestamp("20130102"), 4.5]],
131+
[
132+
[Timestamp("20130101").as_unit("s"), 3.5],
133+
[Timestamp("20130102").as_unit("s"), 4.5],
134+
],
132135
],
133136
)
134137
def test_frame_non_unique_columns(self, orient, data, request):

pandas/tests/io/parser/common/test_common_basic.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ def test_read_csv_local(all_parsers, csv1):
6969
name="index",
7070
),
7171
)
72+
if parser.engine == "pyarrow":
73+
expected.index = expected.index.astype("M8[s]")
7274
tm.assert_frame_equal(result, expected)
7375

7476

@@ -188,6 +190,8 @@ def test_read_csv_dataframe(all_parsers, csv1):
188190
name="index",
189191
),
190192
)
193+
if parser.engine == "pyarrow":
194+
expected.index = expected.index.astype("M8[s]")
191195
tm.assert_frame_equal(result, expected)
192196

193197

pandas/tests/series/methods/test_combine_first.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ def test_combine_first_dt64(self, unit):
8080
rs = s0.combine_first(s1)
8181

8282
xp = Series([datetime(2010, 1, 1), "2011"], dtype=f"datetime64[{unit}]")
83-
83+
if unit in ["s", "ms"]:
84+
# TODO: should _cast_pointwise_result attempt to preserve unit?
85+
xp = xp.dt.as_unit("us")
8486
tm.assert_series_equal(rs, xp)
8587

8688
def test_combine_first_dt_tz_values(self, tz_naive_fixture):

0 commit comments

Comments
 (0)