Пример #1
0
 def test_hour_should_be_5_chars_length(self):
     self.assertEqual(5, len(Hour('11:30').get_hour()))
Пример #2
0
 def test_should_return_the_same_hour(self):
     self.assertEqual('11:15', Hour('11:15').get_hour())
Пример #3
0
 def test_should_raise_error_for_too_much_zeros_befor_hour(self):
     with self.assertRaises(ValueError):
         Hour('001:30')
Пример #4
0
 def test_should_raise_error_for_space_befor_minute(self):
     with self.assertRaises(ValueError):
         Hour('11: 5')
Пример #5
0
 def test_should_raise_error_for_minutes_lower_than_zero(self):
     with self.assertRaises(ValueError):
         Hour('23:-8')
Пример #6
0
 def test_should_raise_error_for_space_befor_hour(self):
     with self.assertRaises(ValueError):
         Hour(' 1:30')
Пример #7
0
 def test_too_short_hour(self):
     with self.assertRaises(ValueError):
         Hour('1:30')
Пример #8
0
 def test_should_raise_error_for_hour_lower_than_zero(self):
     with self.assertRaises(ValueError):
         Hour('-1:11')
Пример #9
0
 def test_should_raise_error_for_hour_greater_than_23(self):
     with self.assertRaises(ValueError):
         Hour('24:11')
Пример #10
0
 def test_should_raise_error_for_minutes_greater_than_59(self):
     with self.assertRaises(ValueError):
         Hour('23:60')
Пример #11
0
 def test_should_raise_error_for_chars_instead_numbers(self):
     with self.assertRaises(ValueError):
         Hour('ab:cd')
Пример #12
0
 def test_should_raise_value_error_with_dot_instead_of_colon(self):
     with self.assertRaises(ValueError):
         Hour('11.15')
Пример #13
0
 def test_should_raise_value_error_without_colon(self):
     with self.assertRaises(ValueError):
         Hour('11152')
Пример #14
0
 def setUp(self) -> None:
     self.time_table = TimeTable(
         (Hour('11:15'), Hour('17:23'), Hour('23:10')))
Пример #15
0
 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