class TestPayRate: shifts = Shifts() def test_get_pay_rate1(self): assert self.shifts.pay_rate(user_time) == 10.0 def test_get_pay_rate2(self): assert self.shifts.pay_rate(user2_time) == 20.0
class TestBreakStartandEnd: shifts = Shifts() def test_start_time(self): assert self.shifts.separate_breaks(user_time, 'start') == datetime( 1900, 1, 1, 15, 00) def test_end_time(self): assert self.shifts.separate_breaks(user2_time, 'end') == datetime( 1900, 1, 1, 16, 10)
class TestStartandEnd: shifts = Shifts() def test_start_time(self): assert self.shifts.shift_start_time(user_time) == datetime( 1900, 1, 1, 10, 00) def test_end_time(self): assert self.shifts.shift_finish_time(user_time) == datetime( 1900, 1, 1, 23, 00)
class TestBringitTogether: shifts = Shifts() def test_come_together_right_now(self): assert self.shifts.bring_shift_together(user_time) == { "Break start": datetime(1900, 1, 1, 15, 00), "Break end": datetime(1900, 1, 1, 18, 00), "Start": datetime(1900, 1, 1, 10, 00), "End": datetime(1900, 1, 1, 23, 00) } def test_come_together_right_now1(self): assert self.shifts.bring_shift_together(user2_time) == { "Break start": datetime(1900, 1, 1, 16, 00), "Break end": datetime(1900, 1, 1, 16, 10), "Start": datetime(1900, 1, 1, 9, 00), "End": datetime(1900, 1, 1, 23, 00) }
class TestShiftwithPay: shifts = Shifts() def test_shift_with_pay(self): assert self.shifts.return_shift_data(user_time) == { "Break start": datetime(1900, 1, 1, 15, 00), "Break end": datetime(1900, 1, 1, 18, 00), "Start": datetime(1900, 1, 1, 10, 00), "End": datetime(1900, 1, 1, 23, 00), "Pay rate": 10.0 } def test_shift_with_pay2(self): assert self.shifts.return_shift_data(user2_time) == { "Break start": datetime(1900, 1, 1, 16, 00), "Break end": datetime(1900, 1, 1, 16, 10), "Start": datetime(1900, 1, 1, 9, 00), "End": datetime(1900, 1, 1, 23, 00), "Pay rate": 20.0 }
class TestTimes: shifts = Shifts() def test_time1(self): assert self.shifts.clean_time('10') == datetime(1900, 1, 1, 10, 00) def test_time2(self): assert self.shifts.clean_time('18:00') == datetime(1900, 1, 1, 18, 00) def test_time3(self): assert self.shifts.clean_time('4pm') == datetime(1900, 1, 1, 16, 00) def test_time4(self): assert self.shifts.clean_time('15 ') == datetime(1900, 1, 1, 15, 00) def test_time5(self): assert self.shifts.clean_time(' 17') == datetime(1900, 1, 1, 17, 00) def test_time6(self): assert self.shifts.clean_time('4.10PM') == datetime(1900, 1, 1, 16, 10)
def process_shifts(path_to_csv): # Done shift_file_data = open(path_to_csv).read() shift = Shifts() return shift.total_labout_cost(shift_file_data)
def get_shifts(self, input): shifts = Shifts() return shifts.return_shift_data(input)