Skip to content

Commit 0385d88

Browse files
committed
refactor(test): remove dead code in test_spec_parser
Remove misplaced @pytest.mark.parametrize decorator from async_variable_hook and delete xfail test_should_evaluate_values_only_once (micro-optimization with negligible practical impact).
1 parent 54fc538 commit 0385d88

1 file changed

Lines changed: 0 additions & 40 deletions

File tree

tests/test_spec_parser.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -256,34 +256,6 @@ def variable_hook(var_name):
256256
assert parsed_expr is original_callback
257257

258258

259-
@pytest.mark.parametrize(
260-
("expression", "expected", "hooks_called"),
261-
[
262-
("49 < frodo_age < 51", True, ["frodo_age"]),
263-
("49 < frodo_age > 50", False, ["frodo_age"]),
264-
(
265-
"aragorn_age < legolas_age < gimli_age",
266-
False,
267-
["aragorn_age", "legolas_age", "gimli_age"],
268-
), # 87 < 2931 and 2931 < 139
269-
(
270-
"gimli_age > aragorn_age < legolas_age",
271-
True,
272-
["gimli_age", "aragorn_age", "legolas_age"],
273-
), # 139 > 87 and 87 < 2931
274-
(
275-
"sword_power < ring_power > bow_power",
276-
True,
277-
["sword_power", "ring_power", "bow_power"],
278-
), # 80 < 100 and 100 > 75
279-
(
280-
"axe_power > sword_power == bow_power",
281-
False,
282-
["axe_power", "sword_power", "bow_power"],
283-
), # 85 > 80 and 80 == 75
284-
("height > 1 and height < 2", True, ["height"]),
285-
],
286-
)
287259
def async_variable_hook(var_name):
288260
"""Variable hook that returns async callables, for testing issue #535."""
289261
values = {
@@ -379,18 +351,6 @@ def test_mixed_sync_async_expressions(expression, expected):
379351
assert result is expected, expression
380352

381353

382-
@pytest.mark.xfail(reason="TODO: Optimize so that expressios are evaluated only once")
383-
def test_should_evaluate_values_only_once(expression, expected, hooks_called):
384-
calls: list[str] = []
385-
386-
def hook(name):
387-
return variable_hook(name, spy=calls.append)
388-
389-
parsed_expr = parse_boolean_expr(expression, hook, operator_mapping)
390-
assert parsed_expr() is expected, expression
391-
assert calls == hooks_called
392-
393-
394354
def test_functions_get_unknown_raises():
395355
"""Functions.get raises ValueError for unknown functions."""
396356
with pytest.raises(ValueError, match="Unsupported function"):

0 commit comments

Comments
 (0)