예제 #1
0
 def test_get_time_raise_exception_because_of_invalid_time_stamp_format(
         self):
     line = 3
     with self.assertRaises(InvalidTimeStampFormating) as error:
         get_time_in_hours_from_midnight('15h', 1, line)
     self.assertEqual(
         "Invalid entry in line " + str(line + 1) +
         " of 'shifts.csv. An unexpected format at the end of a shift was recieved, please use format like '22:16'",
         str(error.exception))
예제 #2
0
 def test_get_time_raise_exception_because_of_invalid_break_start_end_separation(
         self):
     line = 2
     with self.assertRaises(InvalidTimeStampFormating) as error:
         get_time_in_hours_from_midnight('15_18', 0, line)
     self.assertEqual(
         "Invalid entry in line " + str(line + 1) +
         " of 'shifts.csv. Please separate the start and end of the break with a '-'",
         str(error.exception))
예제 #3
0
    def test_get_time_for_simple_break_format(self):
        break_start, break_end = get_time_in_hours_from_midnight('15-18', 0, 1)

        self.assertEqual(break_start, 15)
        self.assertEqual(break_end, 18)
예제 #4
0
    def test_get_time_for_shift_end(self):
        shift_end = get_time_in_hours_from_midnight('5.15', 1, 1)

        self.assertEqual(shift_end, 17.25)
예제 #5
0
    def test_get_time_for_shift_start(self):
        shift_start = get_time_in_hours_from_midnight('10.45', 3, 1)

        self.assertEqual(shift_start, 10.75)
예제 #6
0
    def test_get_time_with_break_format_with_minutes(self):
        break_start, break_end = get_time_in_hours_from_midnight(
            '4-4.30PM', 0, 1)

        self.assertEqual(break_start, 16)
        self.assertEqual(break_end, 16.5)
예제 #7
0
    def test_get_time_for_break_format_with_PM(self):
        break_start, break_end = get_time_in_hours_from_midnight(
            '4PM-5PM', 0, 1)

        self.assertEqual(break_start, 16)
        self.assertEqual(break_end, 17)