Example #1
0
 def test_hour_should_be_5_chars_length(self):
     self.assertEqual(5, len(Hour('11:30').get_hour()))
Example #2
0
 def test_should_return_the_same_hour(self):
     self.assertEqual('11:15', Hour('11:15').get_hour())
Example #3
0
 def test_should_raise_error_for_too_much_zeros_befor_hour(self):
     with self.assertRaises(ValueError):
         Hour('001:30')
Example #4
0
 def test_should_raise_error_for_space_befor_minute(self):
     with self.assertRaises(ValueError):
         Hour('11: 5')
Example #5
0
 def test_should_raise_error_for_minutes_lower_than_zero(self):
     with self.assertRaises(ValueError):
         Hour('23:-8')
Example #6
0
 def test_should_raise_error_for_space_befor_hour(self):
     with self.assertRaises(ValueError):
         Hour(' 1:30')
Example #7
0
 def test_too_short_hour(self):
     with self.assertRaises(ValueError):
         Hour('1:30')
Example #8
0
 def test_should_raise_error_for_hour_lower_than_zero(self):
     with self.assertRaises(ValueError):
         Hour('-1:11')
Example #9
0
 def test_should_raise_error_for_hour_greater_than_23(self):
     with self.assertRaises(ValueError):
         Hour('24:11')
Example #10
0
 def test_should_raise_error_for_minutes_greater_than_59(self):
     with self.assertRaises(ValueError):
         Hour('23:60')
Example #11
0
 def test_should_raise_error_for_chars_instead_numbers(self):
     with self.assertRaises(ValueError):
         Hour('ab:cd')
Example #12
0
 def test_should_raise_value_error_with_dot_instead_of_colon(self):
     with self.assertRaises(ValueError):
         Hour('11.15')
Example #13
0
 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')))
Example #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