test: add 100% coverage for BaseUint arithmetic operators#530
Merged
tcoratger merged 1 commit intoleanEthereum:mainfrom Apr 7, 2026
Merged
test: add 100% coverage for BaseUint arithmetic operators#530tcoratger merged 1 commit intoleanEthereum:mainfrom
tcoratger merged 1 commit intoleanEthereum:mainfrom
Conversation
Closes leanEthereum#521. Adds 116 new tests (275 total) achieving 100% isolated coverage for types/uint.py (197 statements, 56 branches, 0 missing). Covers all previously uncovered operator paths: - Forward arithmetic type errors (__add__, __sub__, etc. with plain int) - Reverse arithmetic success paths (__radd__, __rsub__, etc.) - Exponentiation with modulo and reverse pow - Reverse divmod - Reverse bitwise delegation (__rand__, __ror__, __rxor__) - Reverse shift operators (__rlshift__, __rrshift__) - Comparison type errors (__lt__, __le__ with plain int) - __index__ returns plain int Spec audit confirms SSZ serialization, deserialization, ranges, and fixed-size properties are all correct per the SSZ specification. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/lean_spec/types/uint.py(197 statements, 56 branches, 0 missing)__index__Closes #521
Spec compliance audit
Cross-referenced against the SSZ specification:
No bugs found. Two design notes (not spec violations):
__pow__/shift accept plainintwhile arithmetic requiresBaseUint— pragmatic inconsistency (shift amounts are naturally plain ints)__eq__raisesTypeErroron non-BaseUint — deliberate strictness for spec code safetyTest plan
uv run pytest tests/lean_spec/types/test_uint.py -v)--cov=lean_spec.types.uint --cov-report=term-missing)uvx tox -e all-checks)🤖 Generated with Claude Code