def test_set_from_string(self): date1 = Date() date_string = "2018-08-05" date1.set_from_string(date_string) self.assertEqual(date1.year, 2018) self.assertEqual(date1.month, 8) self.assertEqual(date1.day, 5)
def initiate_new_day_load(self, load_date): """ Initiates the client object daily load properties if the laod_date is a new date compare to the last_load_date and also if this is the very first time loading for the client. It also initiates the client weekly load properties if the load_date is in the same week. """ date = Date() date.set_from_string(load_date) if self.last_load_date.is_different_date(date): self.loadamount_currentday = 0 self.num_loads_currentday = 0 if self.last_load_date.is_different_week(date): self.loadamount_currentweek = 0 self.last_load_date = date