test: add equal-objects-equal-hash tests and enforce static: dict[str… - #32
Merged
Conversation
Contributor
Author
|
@jeqcho have a look |
Contributor
|
Thanks for this. Hashing every spec in |
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.
Closes #30
Summary
Follow-up to #26 closing the two hashability gaps identified in #30:
test_instances_and_realizations_are_hashableto construct two independent but value-equal instances/realizations (a == b), assertinghash(a) == hash(b)and dict key lookup{a: "x"}[b] == "x". This guards against identity-hashing regressions.staticField Type: ChangedTaskInstance.staticannotation fromdict[str, Any]todict[str, Scalar](hashable scalars only) so unhashable structures (e.g. lists) cannot be inserted intostatic.SPECSto verifyhash(instance)succeeds for all 50 instances.Changes
staticfield type annotation fromdict[str, Any]todict[str, Scalar]._render()return signature asnp.ndarray[Any, Any]to satisfymypygeneric requirements.SPECShash iteration.Verification
pytest --covpassed 377/377 tests with 100.00% statement & branch coverage.ruff check .&ruff format --check .passed cleanly.mypystrict type checking passed with 0 issues.