Two tests don't check what their names say: composite trigger does_not_act and subflow pause
While going through test comparisons that are missing assert (so they can never fail), I found two tests where adding the assertion shows the test is not checking what its name says. Both need a decision about intent, so I'm asking before changing them.
1. test_compound_automation_all_double_nested_trigger_any_all_does_not_act
tests/events/server/triggers/test_composite_triggers.py
The docstring says the compound trigger "is not called if the expected event is not present", but the body is:
act.call_count == 2 # no assert
firing: Firing = act.call_args.args[0]
assert (
...so it both never checks the count and inspects act.call_args as if the trigger fired. With assert act.call_count == 2 the test fails:
AssertionError: assert 1 == 2
+ where 1 = <AsyncMock>.call_countThe trigger acts once. Should this test assert that it does not act (call_count == 0, with the firing inspection removed), or is the name/docstring wrong and one call is expected?
2. TestPausingFlows::test_can_not_nonblocking_pause_subflows
tests/server/orchestration/test_core_policy.py
The setup meant to turn the run into a subflow is a comparison, not an assignment:
ctx.run.parent_task_run_id == uuid4()so parent_task_run_id stays None and the test exercises a top-level flow, not a subflow. Changing it to = makes the test fail on a foreign key, because the random UUID does not reference an existing task run:
sqlite3.IntegrityError: FOREIGN KEY constraint failed
[SQL: UPDATE flow_run SET parent_task_run_id=:parent_task_run_id ...]Is creating a real parent task run in the test (e.g. with models.task_runs.create_task_run) the preferred way to set this up?
The rest
The other no-op comparisons I found are unambiguous missing asserts that pass once added, plus test_autoenum_can_be_json_serialized_with_default_encoder, whose expectation was "RED" although json.dumps returns '"RED"'. I've opened a separate PR for those and left these two tests untouched.
Source: PrefectHQ/prefect