Example #1
0
    def test_get_fixed_timezone_usage(self):
        utcnow = datetime.utcnow()

        uktz = get_fixed_timezone(60)
        uknow = (utcnow + timedelta(hours=1)).replace(tzinfo=uktz)

        naiveuk = uknow.astimezone(utctz).replace(tzinfo=None)
        assert utcnow == naiveuk, (utcnow, naiveuk)
Example #2
0
    def test_get_fixed_timezone_name(self):
        uktz = get_fixed_timezone(60)
        uktz_name = uktz.tzname(None)
        assert uktz_name == '+0100', uktz_name
        assert repr(uktz) == '<+0100>', repr(uktz)

        assert utctz.tzname(None) == 'UTC', utctz.tzname(None)
        assert repr(utctz) == '<UTC>', repr(utctz)
Example #3
0
    def test_get_fixed_timezone_name(self):
        uktz = get_fixed_timezone(60)
        uktz_name = uktz.tzname(None)
        assert uktz_name == '+0100', uktz_name
        assert repr(uktz) == '<+0100>', repr(uktz)

        assert utctz.tzname(None) == 'UTC', utctz.tzname(None)
        assert repr(utctz) == '<UTC>', repr(utctz)
Example #4
0
    def test_get_fixed_timezone_usage(self):
        utcnow = datetime.utcnow()

        uktz = get_fixed_timezone(60)
        uknow = (utcnow + timedelta(hours=1)).replace(tzinfo=uktz)

        naiveuk = uknow.astimezone(utctz).replace(tzinfo=None)
        assert utcnow == naiveuk, (utcnow, naiveuk)
Example #5
0
 def test_get_fixed_timezone_hours_td(self):
     delta = get_fixed_timezone(timedelta(hours=1)).utcoffset(None)
     assert delta.seconds == 3600
Example #6
0
 def test_get_fixed_timezone_minutes_td(self):
     delta = get_fixed_timezone(timedelta(minutes=1)).utcoffset(None)
     assert delta.seconds == 60
Example #7
0
 def test_get_fixed_timezone_seconds_td(self):
     delta = get_fixed_timezone(timedelta(seconds=30)).utcoffset(None)
     assert delta.seconds == 0
Example #8
0
 def test_get_fixed_timezone_hours(self):
     delta = get_fixed_timezone(60).utcoffset(None)
     assert delta.seconds == 3600
Example #9
0
 def test_get_fixed_timezone_minutes(self):
     delta = get_fixed_timezone(1).utcoffset(None)
     assert delta.seconds == 60
Example #10
0
 def test_get_fixed_timezone_minutes(self):
     delta = get_fixed_timezone(1).utcoffset(None)
     assert delta.seconds == 60
Example #11
0
 def test_get_fixed_timezone_unknowndst(self):
     uktz = get_fixed_timezone(60)
     assert uktz.dst(None).seconds == 0
Example #12
0
 def test_get_fixed_timezone_hours_td(self):
     delta = get_fixed_timezone(timedelta(hours=1)).utcoffset(None)
     assert delta.seconds == 3600
Example #13
0
 def test_get_fixed_timezone_minutes_td(self):
     delta = get_fixed_timezone(timedelta(minutes=1)).utcoffset(None)
     assert delta.seconds == 60
Example #14
0
 def test_get_fixed_timezone_seconds_td(self):
     delta = get_fixed_timezone(timedelta(seconds=30)).utcoffset(None)
     assert delta.seconds == 0
Example #15
0
 def test_get_fixed_timezone_hours(self):
     delta = get_fixed_timezone(60).utcoffset(None)
     assert delta.seconds == 3600
Example #16
0
 def test_get_fixed_timezone_seconds(self):
     delta = get_fixed_timezone(0.5).utcoffset(None)
     assert delta.seconds == 0
Example #17
0
 def test_get_fixed_timezone_unknowndst(self):
     uktz = get_fixed_timezone(60)
     assert uktz.dst(None).seconds == 0
Example #18
0
 def test_get_fixed_timezone_seconds(self):
     delta = get_fixed_timezone(0.5).utcoffset(None)
     assert delta.seconds == 0