Repository navigation
test: verify hash_record key-order independence - #983
Open
janmejai2002 wants to merge 1 commit into
Open
janmejai2002 wants to merge 1 commit into
janmejai2002 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.
Condition
sqlite_utils.utils.hash_recordpassessort_keys=Truetojson.dumpsso that a record's SHA-1 digest—used forhash_idprimary keys—is independent of dictionary key insertion order.Test Gap
tests/test_utils.py::test_hash_recordonly tests dictionaries whose keys (name,twitter,agewhen filtered viakeys=(name, twitter)) are already in alphabetical insertion order. Changingsort_keys=Truetosort_keys=Falseinhash_recordpreviously passed the entire test suite without failure.Changes
tests/test_utils.py::test_hash_record_key_orderto assert thatutils.hash_record({twitter: CleoPaws, name: Cleo})matches the sorted-key SHA-1 digest and equalsutils.hash_record({name: Cleo, twitter: CleoPaws}).Verification
pytest tests/test_utils.py -k test_hash_record_key_order -v:1 passed, 19 deselectedpytest -q(full suite on Windows, without SpatiaLite):1630 passed, 18 skippedDetected with cordis-verify