Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion half/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,12 @@ def regex(input):


def check_half(bill: str, tax: str, tip: str, expected: str):
check50.run("./half").stdin(bill).stdin(tax).stdin(tip).stdout(regex(expected), expected, regex=True)
output = check50.run("./half").stdin(bill).stdin(tax).stdin(tip).stdout()
regex_output = re.search(regex(expected), output)
if regex_output == None:
if "$" not in output:
help = "Are you sure you included a dollar sign?"
else:
help = "Are you sure the string contains the correct dollar amount?"

raise check50.Missing(f"${expected}", output, help=help)