Repository navigation
fix(bindings): compare serialized values in matches_with - #79
Merged
Merged
Conversation
Literal[T] and Datatype fields hold plain Python values, so calling .n3() on them raised AttributeError. Comparing model_dump() output applies each field's own serializer, keeping all field types consistent. Fixes #76 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Fixes #76
What
BindingModel.matches_withcalled.n3()on the model's raw field values. That fails forLiteral[T]andDatatypefields, which hold plain Python values. It now comparesself.model_dump()output, so each field's own serializer is applied and every field type is compared as N3.matches_with_bindinggets the fix too, because it callsmatches_with.None) fields still match anything.KeyErrorinstead ofAttributeError.Testing
uv run pytest: all tests pass. New tests intests/test_bindings.pycover each field type (Uri,Literal[int|str|datetime],RdfLiteral,Datatype), unset fields, andmatches_with_binding.ruff check/ruff format --check: clean.Related
matches_with. With this change, theUNDEFINEDsentinels are compared through their serialized URI, which fits feat(bindings): add UNDEFINED sentinels for unbound binding values #78's "concrete values, not wildcards" semantics. Expect a small merge conflict.