Update tests/test_utils_eval.py
Run CI Tests / test (push) Successful in 51s

This commit is contained in:
2025-07-31 14:59:28 +02:00
parent a4927fc78c
commit 682466ec7e
+7 -6
View File
@@ -23,7 +23,7 @@ from slic.utils.eval import *
("3 + +4", 7),
("3 + -4", -1),
("True + 1", 2),
("string", "string"),
('string', 'string'),
("1e1000 * 1e1000", float("inf")),
("'a' + 'b'", "ab") # string concatenation supported !!!
])
@@ -36,13 +36,14 @@ def test_arithmetic_eval_valid(expr, expected):
# test ArithmeticEvalError of get_operator
("2 ** 3", "Unsupported BinOp Pow"),
("3 << 1", "Unsupported BinOp LShift"),
("1 < 2", "Unsupported BinOp Lt"),
("abs(3)", "Unsupported Call"),
("a + 2", "Unsupported Name"),
# test ArithmeticEvalError of arithmetic_eval
("[1, 2] + [3]", "Unsupported node type: list"),
("{1: 2}", "Unsupported node type: dict"),
("1 < 2", "Unsupported node type Compare"),
("abs(3)", "Unsupported node type Call"),
("a + 2", "Unsupported node type Name"),
("string", "Unsupported node type Name"),
("[1, 2] + [3]", "Unsupported node type List"),
("{1: 2}", "Unsupported node type Dict"),
])
def test_arithmetic_eval_raises_with_message(expr, expected_message):
with pytest.raises(ArithmeticEvalError, match=expected_message):