Skip to content

Drop the assert wrapping the call that raises in test_zone_ooz_name - #1404

Merged
rthalley merged 1 commit into
rthalley:mainfrom
dylanpulver:tests/drop-assert-on-the-raiser
Nov 4, 2026
Merged

rthalley merged 1 commit into
rthalley:mainfrom
dylanpulver:tests/drop-assert-on-the-raiser

Conversation

@dylanpulver

Copy link
Copy Markdown
Contributor

txn.name_exists() on an out-of-zone name is what raises KeyError, so the assert around it never evaluates its operand.

Checked by inverting it: assert not txn.name_exists(a99) on main leaves the test passing. The call stays, since it is the raiser, and only the assert goes.

tests/test_transaction.py gives 83 passed.

txn.name_exists() on an out-of-zone name is what raises KeyError, so the
assert never evaluates its operand. Inverting it to `assert not` on main
leaves the test passing. The call stays, since it is the raiser.
@rthalley
rthalley merged commit 8c18c13 into rthalley:main Nov 4, 2026
rthalley pushed a commit that referenced this pull request Nov 5, 2026
The assertTrue(False) sits after the from_text call inside
assertRaises(SyntaxError), so it only runs if from_text does not raise, and
assertRaises already fails in that case. Replacing it with a RuntimeError,
which assertRaises(SyntaxError) would not swallow, leaves all ten tests in the
file passing, so the line is unreachable.

testFailFromText2, 3 and 4 do not have it.

This is the same shape as #1404. The assertTrue(False) elsewhere in the suite
is a different idiom: those sit in a try block ahead of an except clause, where
the line does run if the call unexpectedly succeeds.
@github-project-automation github-project-automation Bot moved this from Todo to Done in Merged upstream Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants