fix: validate response shape before indexing in test_query_load_exten...#743
Open
BigNounce90 wants to merge 1 commit into
Open
fix: validate response shape before indexing in test_query_load_exten...#743BigNounce90 wants to merge 1 commit into
BigNounce90 wants to merge 1 commit into
Conversation
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
test_query_load_extensioncalledjson.loads(result.output)[0]without first checking that the parsed list is non-empty, so any empty or truncated CLI output would raise anIndexErrorinstead of a meaningful assertion failure. The fix extracts the parsed result into a local variable and asserts its length before indexing.Why it matters
If the CLI silently produces no rows (e.g. due to a regression in the output serialiser or an unexpected empty result set), the test crashes with an opaque
IndexErrorrather than failing with a diagnostic message pointing at the actual assertion.Testing
The new
assert len(rows) == 1line fires before the index access; all previously-passing inputs still reach and satisfy the original key-shape assertion unchanged.📚 Documentation preview 📚: https://sqlite-utils--743.org.readthedocs.build/en/743/