From 1d0f6100985377a981ece1fbf07b1083e045f39a Mon Sep 17 00:00:00 2001 From: Adam Blank <blank@caltech.edu> Date: Thu, 20 Feb 2025 15:49:06 -0800 Subject: [PATCH] Update test_helpers.py --- tests/helpers/test_helpers.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/helpers/test_helpers.py b/tests/helpers/test_helpers.py index c978154..5cd39e2 100644 --- a/tests/helpers/test_helpers.py +++ b/tests/helpers/test_helpers.py @@ -27,10 +27,17 @@ def myprint(*args, **kwargs): output += " ".join(str(arg) for arg in args) + "\n" +class OutOfInputError(Exception): + pass + + def myinput(prompt): - global input_index - response = input_list[input_index] - input_index += 1 + try: + global input_index + response = input_list[input_index] + input_index += 1 + except IndexError: + raise OutOfInputError return response -- GitLab