@@ -283,14 +283,48 @@ def test_timedelta_ns_based_arithmetic(self):
283283 def test_timedelta_us_arithmetic (self ):
284284 self .assert_ns_timedelta (self .timestamp + np .timedelta64 (- 123 , 'us' ), - 123000 )
285285
286- def test_timedelta_ns_arithmetic (self ):
286+ def test_timedelta_ms_arithmetic (self ):
287287 time = self .timestamp + np .timedelta64 (- 123 , 'ms' )
288288 self .assert_ns_timedelta (time , - 123000000 )
289289
290290 def test_nanosecond_string_parsing (self ):
291291 self .timestamp = Timestamp ('2013-05-01 07:15:45.123456789' )
292292 self .assertEqual (self .timestamp .value , 1367392545123456000 )
293293
294+ def test_nanosecond_timestamp (self ):
295+ # GH 7610
296+ expected = 1293840000000000005
297+ t = Timestamp ('2011-01-01' ) + offsets .Nano (5 )
298+ self .assertEqual (repr (t ), "Timestamp('2011-01-01 00:00:00.000000005')" )
299+ self .assertEqual (t .value , expected )
300+ self .assertEqual (t .nanosecond , 5 )
301+
302+ t = Timestamp (t )
303+ self .assertEqual (repr (t ), "Timestamp('2011-01-01 00:00:00.000000005')" )
304+ self .assertEqual (t .value , expected )
305+ self .assertEqual (t .nanosecond , 5 )
306+
307+ t = Timestamp (np .datetime64 ('2011-01-01 00:00:00.000000005Z' ))
308+ self .assertEqual (repr (t ), "Timestamp('2011-01-01 00:00:00.000000005')" )
309+ self .assertEqual (t .value , expected )
310+ self .assertEqual (t .nanosecond , 5 )
311+
312+ expected = 1293840000000000010
313+ t = t + offsets .Nano (5 )
314+ self .assertEqual (repr (t ), "Timestamp('2011-01-01 00:00:00.000000010')" )
315+ self .assertEqual (t .value , expected )
316+ self .assertEqual (t .nanosecond , 10 )
317+
318+ t = Timestamp (t )
319+ self .assertEqual (repr (t ), "Timestamp('2011-01-01 00:00:00.000000010')" )
320+ self .assertEqual (t .value , expected )
321+ self .assertEqual (t .nanosecond , 10 )
322+
323+ t = Timestamp (np .datetime64 ('2011-01-01 00:00:00.000000010Z' ))
324+ self .assertEqual (repr (t ), "Timestamp('2011-01-01 00:00:00.000000010')" )
325+ self .assertEqual (t .value , expected )
326+ self .assertEqual (t .nanosecond , 10 )
327+
294328 def test_nat_arithmetic (self ):
295329 # GH 6873
296330 nat = tslib .NaT
0 commit comments