Skip to content

Commit

Permalink
Adjust per review.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyandrewmeyer committed Sep 15, 2024
1 parent 36b0aba commit 6a22325
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions interface_tester/interface_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,12 @@ def _run_scenario(self, event: Union[str, _Event], state: State):
return ctx.run(event, state)

def _cast_event(self, raw_event: Union[str, _Event], relation: Relation):
if not isinstance(raw_event, (_Event, str)):
raise InvalidTestCaseError(
f"Bad interface test specification: event {raw_event} should be a relation event "
f"string or _Event."
)

if isinstance(raw_event, str):
if raw_event.endswith("-relation-changed"):
event = CharmEvents.relation_changed(relation)
Expand All @@ -430,12 +436,6 @@ def _cast_event(self, raw_event: Union[str, _Event], relation: Relation):
f"Bad interface test specification: event {raw_event} is not a relation event."
)

if not isinstance(event, _Event):
raise InvalidTestCaseError(
f"Bad interface test specification: event {raw_event} should be a relation event "
f"string or _Event."
)

# todo: if the user passes a relation event that is NOT about the relation
# interface that this test is about, at this point we are injecting the wrong
# Relation instance.
Expand Down

0 comments on commit 6a22325

Please sign in to comment.