Skip to content

Commit

Permalink
update astype test
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel committed Nov 1, 2023
1 parent 4c8c5ad commit 31462dc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pandas/tests/series/methods/test_astype.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,11 @@ def test_astype_object_to_dt64_non_nano(self, tz):
ser = Series(vals, dtype=object)
result = ser.astype(dtype)

exp_arr = np.array([ts.asm8, vals[1], 2], dtype="M8[us]")
expected = Series(exp_arr, dtype="M8[us]").dt.tz_localize(tz)
exp_vals = [Timestamp(x, tz=tz).as_unit("us").asm8 for x in vals]
exp_arr = np.array(exp_vals, dtype="M8[us]")
expected = Series(exp_arr, dtype="M8[us]")
if tz is not None:
expected = expected.dt.tz_localize("UTC").dt.tz_convert(tz)
tm.assert_series_equal(result, expected)

def test_astype_mixed_object_to_dt64tz(self):
Expand Down

0 comments on commit 31462dc

Please sign in to comment.