def test__parse_time(): """Test static function _parse_time().""" from datetime import time def test_TypeError(time): """Test TypeError raising during Appointment._parse_time().""" with pytest.raises(TypeError) as excinfo: Appointment._parse_time(time) def test_ValueError(time): """Test ValueError raising during Appointment._parse_time().""" with pytest.raises(ValueError) as excinfo: Appointment._parse_time(time) test_TypeError(None) test_TypeError(object) test_ValueError("string") test_ValueError("1::00pm") test_ValueError("1:0pm") test_ValueError("110:0pm") test_ValueError("11:00") test_ValueError("13:00am") test_ValueError("-1:00am") test_ValueError("15:00pm") test_ValueError("1:15am") test_ValueError("1:07am") test_ValueError("1:00gm") test_ValueError("1:00m") assert Appointment._parse_time("12:00pm") == time(12, 0) assert Appointment._parse_time("0:00am") == time(0, 0) assert Appointment._parse_time("1:30am") == time(1, 30) assert Appointment._parse_time("1:30pm") == time(13, 30) assert Appointment._parse_time("11:30pm") == time(23, 30)
def test_TypeError(time): """Test TypeError raising during Appointment._parse_time().""" with pytest.raises(TypeError) as excinfo: Appointment._parse_time(time)