Skip to content

Commit 291eb2d

Browse files
committed
added coverage for datetime with timezone in extension_array test
1 parent e7e9a48 commit 291eb2d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pandas/tests/dtypes/cast/test_infer_dtype.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
infer_dtype_from_scalar,
1010
)
1111
from pandas.core.dtypes.common import is_dtype_equal
12-
from pandas.core.dtypes.dtypes import IntervalDtype, PeriodDtype
12+
from pandas.core.dtypes.dtypes import DatetimeTZDtype, IntervalDtype, PeriodDtype
1313

1414
from pandas import (
1515
Categorical,
@@ -205,6 +205,10 @@ def test_cast_scalar_to_numpy_array(obj, dtype):
205205
[
206206
(Period("2011-01-01", freq="D"), PeriodDtype("D")),
207207
(Interval(left=0, right=5), IntervalDtype("int64")),
208+
(
209+
Timestamp("2011-01-01", tz="US/Eastern"),
210+
DatetimeTZDtype(unit="ns", tz="US/Eastern"),
211+
),
208212
],
209213
)
210214
def test_cast_scalar_to_extension_array(obj, dtype):
@@ -215,3 +219,6 @@ def test_cast_scalar_to_extension_array(obj, dtype):
215219

216220
arr = cast_scalar_to_array(shape, obj, dtype=dtype)
217221
tm.assert_extension_array_equal(arr[0], exp)
222+
223+
arr = cast_scalar_to_array(shape, obj, dtype=None)
224+
tm.assert_extension_array_equal(arr[0], exp)

0 commit comments

Comments
 (0)