def test_hour_should_be_5_chars_length(self): self.assertEqual(5, len(Hour('11:30').get_hour()))
def test_should_return_the_same_hour(self): self.assertEqual('11:15', Hour('11:15').get_hour())
def test_should_raise_error_for_too_much_zeros_befor_hour(self): with self.assertRaises(ValueError): Hour('001:30')
def test_should_raise_error_for_space_befor_minute(self): with self.assertRaises(ValueError): Hour('11: 5')
def test_should_raise_error_for_minutes_lower_than_zero(self): with self.assertRaises(ValueError): Hour('23:-8')
def test_should_raise_error_for_space_befor_hour(self): with self.assertRaises(ValueError): Hour(' 1:30')
def test_too_short_hour(self): with self.assertRaises(ValueError): Hour('1:30')
def test_should_raise_error_for_hour_lower_than_zero(self): with self.assertRaises(ValueError): Hour('-1:11')
def test_should_raise_error_for_hour_greater_than_23(self): with self.assertRaises(ValueError): Hour('24:11')
def test_should_raise_error_for_minutes_greater_than_59(self): with self.assertRaises(ValueError): Hour('23:60')
def test_should_raise_error_for_chars_instead_numbers(self): with self.assertRaises(ValueError): Hour('ab:cd')
def test_should_raise_value_error_with_dot_instead_of_colon(self): with self.assertRaises(ValueError): Hour('11.15')
def test_should_raise_value_error_without_colon(self): with self.assertRaises(ValueError): Hour('11152')
def setUp(self) -> None: self.time_table = TimeTable( (Hour('11:15'), Hour('17:23'), Hour('23:10')))
def get_hour_in_seconds(formatted_hour: str): Hour(formatted_hour) hour, minutes = int(formatted_hour.split(':')[0]), int( formatted_hour.split(':')[1]) return hour * 3600 + minutes * 60