From 1bcf95a8c2576d53f3070e273d5b285524523594 Mon Sep 17 00:00:00 2001 From: Explodey Wolf <67061920+Explodey-Wolf@users.noreply.github.com> Date: Wed, 29 May 2024 15:45:54 -0400 Subject: [PATCH] Update __init__.py to include better help messages. --- half/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/half/__init__.py b/half/__init__.py index f92c029..c04b839 100644 --- a/half/__init__.py +++ b/half/__init__.py @@ -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) \ No newline at end of file + 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)