def test_weekdaypstr(): for string, weekdayno in [ ('monday', 0), ('tue', 1), ('wednesday', 2), ('thursday', 3), ('fri', 4), ('saturday', 5), ('sun', 6), ]: assert weekdaypstr(string) == weekdayno
def test_weekdaypstr_invalid(): with pytest.raises(ValueError): weekdaypstr('foobar')