Beispiel #1
0
    def test_correctly_changes_hours_and_minutes(self):
        # Test to see if hours and minutes correctly subtract
        initial = datetime(2017, 1, 1, 1, 59)
        t = TimeZoneConverter("-01:59")
        expected = datetime(2017, 1, 1)
        self.assertEqual(t.convert(initial), expected)

        # Test to see if they correctly add
        t = TimeZoneConverter("+01:02")
        expected = datetime(2017, 1, 1, 3, 1)
        self.assertEqual(t.convert(initial), expected)
Beispiel #2
0
    def test_correctly_changes_day(self):
        # See if time rolls back
        initial = datetime(2017, 1, 1)

        t = TimeZoneConverter("-01:00")
        expected = datetime(2016, 12, 31, 23, 0)
        self.assertEqual(t.convert(initial), expected)

        # See if time rolls forward
        t = TimeZoneConverter("+24:30")
        expected = datetime(2017, 1, 2, 0, 30)
        self.assertEqual(t.convert(initial), expected)