diff options
Diffstat (limited to 'rdiff-backup/testing/timetest.py')
-rw-r--r-- | rdiff-backup/testing/timetest.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/rdiff-backup/testing/timetest.py b/rdiff-backup/testing/timetest.py index 0ab8514..56052ca 100644 --- a/rdiff-backup/testing/timetest.py +++ b/rdiff-backup/testing/timetest.py @@ -94,5 +94,17 @@ class TimeTest(unittest.TestCase): self.assertRaises(Time.TimeException, g2t, "") self.assertRaises(Time.TimeException, g2t, "3q") + def testTimeZone(self): + """Test stringtotime on two strings straddling timezones""" + f = Time.stringtotime + invf = Time.timetostring + s1 = "2005-04-03T03:45:03-03:00" + s2 = "2005-04-03T02:45:03-03:00" + diff = f(s1) - f(s2) + assert diff == 3600, diff + + assert f(invf(f(s1))) == f(s1), (s1, invf(f(s1)), f(invf(f(s1))), f(s1)) + assert f(invf(f(s2))) == f(s2), (s2, f(invf(f(s2))), f(s2)) + if __name__ == '__main__': unittest.main() |