def test_datetime_000_15(self): """Test method 'MythTV.datetime.frommythtime(cls, mtime, tz=None)""" dt14_int = 20200102030405 dt14 = datetime.frommythtime(dt14_int) #print(dt14, type(dt14)) #print(dt14.utcoffset()) dt15 = datetime.frommythtime(dt14_int, tz='UTC') #print(dt15, type(dt15)) self.assertEqual((dt15 - dt14), dt14.utcoffset(), "'frommythtime()' returned wrong offset")
def test_datetime_000_16(self): """Test method 'MythTV.datetime.mythformat""" dt16_int = 20200102030405 dt16 = datetime.frommythtime(dt16_int, tz='UTC') dt17 = dt16.mythformat() #print(dt17, type(dt17)) self.assertEqual(dt16_int, int(dt17), "'mythformat()' returned wrong stamp")
def test_datetime_002_06(self): """Test 'mythtime (i.e. integer time)' to 'UTC' conversion in respect to daylight saving time of 'America/Anchorage' using 'frommythtime(,tz='UTC')' method. """ for i, t in enumerate(self.t_mtime_list): t_frommythtime = datetime.frommythtime(t, tz='UTC') t_org = t_frommythtime.isoformat() self.assertTrue(isinstance(t_frommythtime, datetime)) # check if conversion works: self.assertEqual(t_org, self.t_mtime_iso_utc_list[i]) # check for correct types: self.assertTrue(isinstance(t_frommythtime, datetime)) self.assertTrue('posixtzinfo' in repr(t_frommythtime.tzinfo))
def setUp(self): # find recordings for standard times and daylight saving times: self.t1_cet = datetime.frommythtime(int(self.testenv['T1_STDT'])) self.t2_cet = datetime.frommythtime(int(self.testenv['T2_STDT'])) self.t1_cest = datetime.frommythtime(int(self.testenv['T1_ST'])) self.t2_cest = datetime.frommythtime(int(self.testenv['T2_ST']))