From 3c5564927d403452a820fab972625fc32df59c80 Mon Sep 17 00:00:00 2001 From: Matthew Newville Date: Sun, 22 Sep 2024 10:48:36 -0500 Subject: [PATCH] add test for GH133 --- tests/test_asteval.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_asteval.py b/tests/test_asteval.py index 6940560..a85d3d2 100644 --- a/tests/test_asteval.py +++ b/tests/test_asteval.py @@ -1530,6 +1530,18 @@ def test_no_duplicate_exception(nested): assert len(interp.error) == 1 assert interp.error[0].exc == NameError +@pytest.mark.parametrize("nested", [False, True]) +def test_raise_errors_unknown_symbol(nested): + """ test that raise_error raises corret error type. GH #133 + """ + interp = make_interpreter(nested_symtable=nested) + try: + saw_exception = False + interp.run("unknown_value", with_raise=True) + except NameError: + saw_exception = True + assert saw_exception + @pytest.mark.parametrize("nested", [False, True]) def test_delete_slice(nested):