Skip to content

Commit 69a313e

Browse files
committed
issue_21 - added additional test for timezone and tzoffset
1 parent fb2330b commit 69a313e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ def testParse(self):
4848
# TZ offset inside of date string with datemath
4949
self.assertEqual(datemath('2016-01-01T16:20:00.5+12:00||+1d'), pydatetime(2016, 1, 2, 16, 20, 0, 500000, tzinfo=tz.tzoffset(None, timedelta(hours=12))))
5050
self.assertEqual(datemath('2016-01-01T16:20:00.6+12:00||+2d+1h'), pydatetime(2016, 1, 3, 17, 20, 0, 600000, tzinfo=tz.tzoffset(None, timedelta(hours=12))))
51-
51+
# If a TZ offset is in a datetime string, and there is a tz param used, the TZ offset will take precedence for the returned timeobj
52+
self.assertEqual(datemath('2016-01-01T16:20:00.6+12:00||+2d+1h', tz='US/Eastern'), pydatetime(2016, 1, 3, 17, 20, 0, 600000, tzinfo=tz.tzoffset(None, timedelta(hours=12))))
53+
5254
# relitive formats
5355
# addition
5456
self.assertEqual(dm('+1s').format(iso8601), arrow.utcnow().shift(seconds=+1).format(iso8601))

0 commit comments

Comments
 (0)