def test_arrow_to_appt(self): """ Tests the conversion of arrow objects to Appt. """ test_date_begin = arrow.get('2015-11-20T00:00:00-08:00') test_date_end = arrow.get('2015-11-20T15:30:00-08:00') self.assertNotEqual(test_date_begin,arrow.arrow.Arrow) busy = Appt(test_date_begin.date(),test_date_begin.time(),test_date_end.time(),"Arrow") self.assertIsInstance(busy,Appt) expected = Appt(datetime.date(2015, 11, 20),datetime.time(0,0),datetime.time(15,30),"Expected") self.assertTrue(busy.__eq__(expected))
def test_different_timezones(self): """ Tests for correct handling of different timezones when converting arrow to appointments. """ test_date_pst = arrow.get('2015-11-20T08:00:00-08:00').to('local') test_date_gmt = arrow.get('2015-11-20T00:00:00+08:00').to('local') self.assertNotEqual(test_date_pst,test_date_gmt) appt_pst = Appt(test_date_pst.date(),test_date_pst.time(),datetime.time(12,0),"PST Appt Midnight-4am") appt_gmt = Appt(test_date_gmt.date(),test_date_gmt.time(),datetime.time(12,0),"GMT Appt") self.assertTrue(appt_pst.__eq__(appt_gmt))