Skip to content

Commit

Permalink
Fix error message testing
Browse files Browse the repository at this point in the history
  • Loading branch information
joetayloruk committed Mar 12, 2021
1 parent d1c477c commit 5591d69
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
10 changes: 5 additions & 5 deletions features/steps/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ def step_impl(context, exception_type):

def remove_whitespace(text):
return " ".join(
line.strip()
for line in context.text.splitlines()
line.strip('"')
for line in text.splitlines()
).strip()

if remove_whitespace(context.text) != remove_whitespace(context.exception):
if remove_whitespace(context.text) != remove_whitespace(str(context.exception)):
raise Exception(
f"""
Expected error message:
{context.text}
{remove_whitespace(context.text)}
Got:
{context.exception}
{remove_whitespace(str(context.exception))}
"""
)

Expand Down
6 changes: 2 additions & 4 deletions wysdom/mixins/RegistersSubclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,8 @@ def registered_subclass(
):
return matched_subclass
raise KeyError(
f"""
The key '{name}' is ambiguous as it matches multiple proper subclasses of {cls}:
{matched_subclasses}
""")
f"The key '{name}' is ambiguous as it matches multiple proper subclasses of {cls}: "
f"{matched_subclasses}")
return matched_subclasses[0]

@classmethod
Expand Down

0 comments on commit 5591d69

Please sign in to comment.