Example #1
0
 def test_compare_micros(self):
     zulu = utils.parse_isotime('2012-02-14T20:53:07.6544')
     east = utils.parse_isotime('2012-02-14T19:53:07.654321-01:00')
     west = utils.parse_isotime('2012-02-14T21:53:07.655+01:00')
     self.assertTrue(east < west)
     self.assertTrue(east < zulu)
     self.assertTrue(zulu < west)
Example #2
0
 def test_compare(self):
     zulu = utils.parse_isotime('2012-02-14T20:53:07')
     east = utils.parse_isotime('2012-02-14T20:53:07-01:00')
     west = utils.parse_isotime('2012-02-14T20:53:07+01:00')
     self.assertTrue(east > west)
     self.assertTrue(east > zulu)
     self.assertTrue(zulu > west)
Example #3
0
 def test_west_normalize(self):
     str = '2012-02-14T20:53:07+21:00'
     west = utils.parse_isotime(str)
     normed = utils.normalize_time(west)
     self._instaneous(normed, 2012, 2, 13, 23, 53, 07, 0)
Example #4
0
 def test_east_normalize(self):
     str = '2012-02-14T20:53:07-07:00'
     east = utils.parse_isotime(str)
     normed = utils.normalize_time(east)
     self._instaneous(normed, 2012, 2, 15, 03, 53, 07, 0)
Example #5
0
 def test_zulu_normalize(self):
     str = '2012-02-14T20:53:07Z'
     zulu = utils.parse_isotime(str)
     normed = utils.normalize_time(zulu)
     self._instaneous(normed, 2012, 2, 14, 20, 53, 07, 0)
Example #6
0
 def test_now_roundtrip(self):
     str = utils.isotime()
     now = utils.parse_isotime(str)
     self.assertEquals(now.tzinfo, iso8601.iso8601.UTC)
     self.assertEquals(utils.isotime(now), str)
Example #7
0
 def test_west_roundtrip(self):
     str = '2012-02-14T20:53:07+11:30'
     west = utils.parse_isotime(str)
     self.assertEquals(west.tzinfo.tzname(None), '+11:30')
     self.assertEquals(utils.isotime(west), str)
Example #8
0
 def test_east_roundtrip(self):
     str = '2012-02-14T20:53:07-07:00'
     east = utils.parse_isotime(str)
     self.assertEquals(east.tzinfo.tzname(None), '-07:00')
     self.assertEquals(utils.isotime(east), str)
Example #9
0
 def test_zulu_roundtrip(self):
     str = '2012-02-14T20:53:07Z'
     zulu = utils.parse_isotime(str)
     self.assertEquals(zulu.tzinfo, iso8601.iso8601.UTC)
     self.assertEquals(utils.isotime(zulu), str)
Example #10
0
 def _do_test(self, str, yr, mon, day, hr, min, sec, micro, shift):
     DAY_SECONDS = 24 * 60 * 60
     timestamp = utils.parse_isotime(str)
     self._instaneous(timestamp, yr, mon, day, hr, min, sec, micro)
     offset = timestamp.tzinfo.utcoffset(None)
     self.assertEqual(offset.seconds + offset.days * DAY_SECONDS, shift)