forked from molecule-ai/molecule-core
test(inbox): bind side-effecting pop() before assert
CodeQL flagged the bare `assert state.pop(...) is None` — under `python -O` asserts are stripped, which would skip the call entirely and the test would silently pass without exercising the code. Bind the result first so the call always runs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b47d4ceb00
commit
d061642cfc
@ -182,7 +182,10 @@ def test_pop_removes_specific_message(state: inbox.InboxState):
|
||||
|
||||
def test_pop_missing_id_returns_none(state: inbox.InboxState):
|
||||
state.record(_msg("a"))
|
||||
assert state.pop("does-not-exist") is None
|
||||
# Bind the result before asserting so the call still runs under
|
||||
# ``python -O`` (which strips bare assert statements).
|
||||
result = state.pop("does-not-exist")
|
||||
assert result is None
|
||||
# Original message still present
|
||||
assert len(state.peek(10)) == 1
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user