Skip to content

Commit

Permalink
catch IndexError
Browse files Browse the repository at this point in the history
  • Loading branch information
CarterZenke committed Feb 7, 2024
1 parent 2dc4ea2 commit 2a45f27
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion me/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ def check_name(name):

# Check output
if not re.match(regex(name), actual):
if actual[-1] != "\n":
try:
last_character = actual[-1]
except IndexError:
raise check50.Mismatch(expected=expected, actual=actual)

if last_character != "\n":
raise check50.Mismatch(
expected=expected,
actual=actual,
Expand Down

0 comments on commit 2a45f27

Please sign in to comment.