Spaces:
Running
Running
| import pytest | |
| from joblib._utils import eval_expr | |
| def test_eval_expr_invalid(expr): | |
| with pytest.raises(ValueError, match="is not a valid or supported arithmetic"): | |
| eval_expr(expr) | |
| def test_eval_expr_too_long(): | |
| expr = "1" + "+1" * 50 | |
| with pytest.raises(ValueError, match="is too long"): | |
| eval_expr(expr) | |
| def test_eval_expr_too_large_literal(expr): | |
| with pytest.raises(ValueError, match="Numeric literal .* is too large"): | |
| eval_expr(expr) | |
| def test_eval_expr_valid(expr, result): | |
| assert eval_expr(expr) == result | |