def test_from_12_hour_time_excepts_on_invalid_times(self): for time_str, hr24, min in _some_invalid_12hr_clk_times(): with self.assertRaises(InvalidTime, msg=time_str) as e: TimeOfDay.from_12_hour_time(time_str)
def test_from_12_hour_time_works_for_valid_times(self): tod = TimeOfDay.from_12_hour_time(VALID_12_CLK_TIME_STR) self.assertIsInstance(tod, TimeOfDay) self.assertEqual(tod.hour, VALID_12_CLK_TIME_HR) self.assertEqual(tod.minute, VALID_12_CLK_TIME_MIN)