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