From b902c787e9ee902caedce055c91c21b900c4dc0a Mon Sep 17 00:00:00 2001 From: tligui_y Date: Thu, 31 Jul 2025 14:42:18 +0200 Subject: [PATCH] Update tests/test_utils_eval.py --- tests/test_utils_eval.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_utils_eval.py b/tests/test_utils_eval.py index 6feed94a6..c7d9a8655 100644 --- a/tests/test_utils_eval.py +++ b/tests/test_utils_eval.py @@ -22,6 +22,10 @@ from slic.utils.eval import * ("-(-(-2))", -2), ("3 + +4", 7), ("3 + -4", -1), + ("True + 1", 2), + ("string", "string"), + ("1e1000 * 1e1000", inf), + ("'a' + 'b'", "ab") # string concatenation supported !!! ]) def test_arithmetic_eval_valid(expr, expected): assert arithmetic_eval(expr) == expected @@ -33,9 +37,6 @@ def test_arithmetic_eval_valid(expr, expected): "1 < 2", # comparison not supported "abs(3)", # function call not supported "a + 2", # undefined variable - "'a' + 'b'", # string concatenation not supported - "'string'", # string constant alone - "True + 1", # booleans not explicitly supported "[1, 2] + [3]", # lists not supported "{1: 2}", # dicts not supported ]) @@ -46,8 +47,7 @@ def test_arithmetic_eval_raises(expr): # Expressions that are syntactically valid but cause Python runtime errors @pytest.mark.parametrize("expr, exception", [ ("1 / 0", ZeroDivisionError), - ("10 % 0", ZeroDivisionError), - ("1e1000 * 1e1000", OverflowError), + ("10 % 0", ZeroDivisionError), ]) def test_arithmetic_eval_runtime_errors(expr, exception): with pytest.raises(exception):