Exemple #1
0
 def test_offset_by_time_pass_0(self):
     u = Unit("hour")
     v = u.offset_by_time(unit.encode_time(2007, 1, 15, 12, 6, 0))
     self.assertEqual(v, "(3600 s) @ 20070115T120600.00000000 UTC")
Exemple #2
0
 def test_encode_time_pass_0(self):
     result = unit.encode_time(2006, 1, 15, 12, 6, 0)
     self.assertEqual(result, 159019560.0)
Exemple #3
0
 def test_offset_by_time_fail_3(self):
     u = Unit('no unit')
     self.assertRaises(ValueError, u.offset_by_time, unit.encode_time(1970, 1, 1, 0, 0, 0))
Exemple #4
0
 def test_encode_time_pass_0(self):
     result = unit.encode_time(2006, 1, 15, 12, 6, 0)
     self.assertEqual(result, 159019560.0)
Exemple #5
0
 def test_offset_by_time_pass_0(self):
     u = Unit("hour")
     v = u.offset_by_time(unit.encode_time(2007, 1, 15, 12, 6, 0))
     self.assertEqual(v, "(3600 s) @ 20070115T120600.00000000 UTC")
Exemple #6
0
 def test_offset_by_time_fail_3(self):
     u = Unit('no unit')
     self.assertRaises(ValueError, u.offset_by_time, unit.encode_time(1970, 1, 1, 0, 0, 0))
Exemple #7
0
 def test_offset_by_time_fail_2(self):
     u = Unit("unknown")
     self.assertRaises(ValueError, u.offset_by_time, unit.encode_time(1970, 1, 1, 0, 0, 0))