def test_outcome_is_billing(outcome: Outcome, is_billing: bool): """ Tests the complete behavior of ``is_billing``, used for routing outcomes to different Kafka topics. This is more of a sanity check to prevent unintentional changes. """ assert outcome.is_billing() is is_billing
def map_row(self, row: MutableMapping[str, Any]) -> None: if "outcome" in row: row["outcome"] = Outcome(row["outcome"]).api_name()
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