Skip to content

Commit 32be313

Browse files
committed
TST: tests for GH7594, ensure conversion on tz-aware datetimes in the constructors
1 parent 4082c1a commit 32be313

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pandas/tests/test_frame.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3587,6 +3587,19 @@ def test_constructor_with_datetimes(self):
35873587
expected.sort_index()
35883588
assert_series_equal(result, expected)
35893589

3590+
# GH 7594
3591+
# don't coerce tz-aware
3592+
import pytz
3593+
tz = pytz.timezone('US/Eastern')
3594+
dt = tz.localize(datetime(2012, 1, 1))
3595+
df = DataFrame({'End Date': dt}, index=[0])
3596+
self.assertEqual(df.iat[0,0],dt)
3597+
assert_series_equal(df.dtypes,Series({'End Date' : np.dtype('object') }))
3598+
3599+
df = DataFrame([{'End Date': dt}])
3600+
self.assertEqual(df.iat[0,0],dt)
3601+
assert_series_equal(df.dtypes,Series({'End Date' : np.dtype('object') }))
3602+
35903603
def test_constructor_for_list_with_dtypes(self):
35913604
intname = np.dtype(np.int_).name
35923605
floatname = np.dtype(np.float_).name

0 commit comments

Comments
 (0)