Commit 0a1dbcf
Replace defensive isinstance check with assertion in call_historic
Convert the isinstance(res, list) conditional to an assertion since
res is guaranteed to always be a list in call_historic:
1. Historic hooks are called with firstresult=False, which always
returns a list from _multicall
2. Historic hooks cannot have wrappers/hookwrappers (enforced by
validation), so no teardowns can modify the result type
This change:
- Documents the invariant explicitly
- Achieves 100% branch coverage on _hooks.py (was 99%)
- Makes the code clearer by removing unreachable defensive code
- Will catch future bugs if the invariant is violated
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 8539ded commit 0a1dbcf
2 files changed
+7
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
535 | | - | |
536 | | - | |
537 | | - | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
538 | 540 | | |
539 | 541 | | |
540 | 542 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
| 222 | + | |
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
| 227 | + | |
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
| |||
0 commit comments