Skip to content

Commit 334b4db

Browse files
author
y-p
committed
TST: Timestamp repr is valid python code
1 parent 3396dca commit 334b4db

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas/tseries/tests/test_period.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,14 @@ def test_to_timestamp_preserve_name(self):
12981298
conv = index.to_timestamp('D')
12991299
self.assertEquals(conv.name, 'foo')
13001300

1301+
def test_to_timestamp_repr_is_code(self):
1302+
zs=[Timestamp('99-04-17 00:00:00',tz='UTC'),
1303+
Timestamp('2001-04-17 00:00:00',tz='UTC'),
1304+
Timestamp('2001-04-17 00:00:00',tz='America/Los_Angeles'),
1305+
Timestamp('2001-04-17 00:00:00',tz=None)]
1306+
for z in zs:
1307+
self.assertEquals( eval(repr(z)), z)
1308+
13011309
def test_as_frame_columns(self):
13021310
rng = period_range('1/1/2000', periods=5)
13031311
df = DataFrame(randn(10, 5), columns=rng)

0 commit comments

Comments
 (0)