def _parse_outcome(outcome: str) -> Outcome: try: return Outcome.parse(outcome) except KeyError: raise InvalidField(f'Invalid outcome: "{outcome}"')
def test_parse_outcome(name, outcome): """ Asserts *case insensitive* parsing of outcomes from their canonical names, as used in the API and queries. """ assert Outcome.parse(name) == outcome