Exemple #1
0
 def test(self, h, m, name):
     tz_delta = datetime.timedelta(hours=h, minutes=m)
     tz = FixedOffsetTimezone(tz_delta)
     assert tz.utcoffset(None) is tz_delta
     assert tz.dst(None) == datetime.timedelta(0)
     assert tz.tzname(None) == name
     assert str(tz) == "FixedOffsetTimezone " + name
 def test(self, h, m, name):
     tz_delta = datetime.timedelta(hours=h, minutes=m)
     tz = FixedOffsetTimezone(tz_delta)
     assert tz.utcoffset(None) is tz_delta
     assert tz.dst(None) == datetime.timedelta(0)
     assert tz.tzname(None) == name
     assert str(tz) == "FixedOffsetTimezone " + name
Exemple #3
0
 def testConstructFromInteger(self, hours):
     tz = FixedOffsetTimezone(hours)
     assert tz.utcoffset(None) == datetime.timedelta(hours=hours)
 def testTranslatePythonObjectToString(self):
     time = datetime.time(16, 53, 12, tzinfo=FixedOffsetTimezone(4))
     translated = XTime.translate(time, topython=False)
     assert isinstance(translated, str)
     assert translated == "16:53:12+04:00"
 def testConstructFromString_timezone(self, string, h, m, s, micros, tz_h,
                                      tz_m):
     tzdelta = datetime.timedelta(hours=tz_h, minutes=tz_m)
     tzinfo = FixedOffsetTimezone(tzdelta)
     ref = datetime.time(h, m, s, micros, tzinfo=tzinfo)
     assert Time(string).value == ref
 def testConstructFromDateTime_tzAware(self, hours):
     tz = FixedOffsetTimezone(10)
     date = datetime.datetime(2001, 12, 10, hours, 50, 21, 32132, tzinfo=tz)
     assert Date(date).value == datetime.date(2001, 12, 10)
 def testConstructFromInteger(self, hours):
     tz = FixedOffsetTimezone(hours)
     assert tz.utcoffset(None) == datetime.timedelta(hours=hours)