Reject adding objects owned by another document - #480
Merged
tcmitchell merged 2 commits intoSep 30, 2026
Merged
Conversation
Collaborator
|
Thanks @Shubham-Padkonde ! This looks good. I ran the GitHub actions on your pull request and it passed all the testing, which includes multiple versions of Python. Can I ask that you please add some comments to the two unit tests to explain what they are testing? Just an overview comment that says what the unit test does or what it tests for. And please include a link to the GitHub Issue URL as well so we can refer back to it if we ever need to. Once the comments are added please add a comment here. I should be able to merge this pull request then. Thanks again! |
Collaborator
|
Thanks for adding comments and links to the new unit tests, and thanks very much for taking on this task! |
tcmitchell
approved these changes
Sep 30, 2026
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 #416.
Adding an existing top-level object to a second document currently leaves it in the first document while changing its document reference (and its children's references) to the second. Reject that addition with
ValueErrorbefore modifying either document, as proposed in the issue discussion.Regression coverage exercises both single-object and list input, checks that child ownership is preserved, and confirms that removal followed by addition to another document still works. Both second-document cases failed before the fix.
Validation on Python 3.13:
python -We -m unittest discover -s testran 223 tests successfully with one existing expected failure, using the pinned SBOLTestSuite submodule.pycodestyle sbol3 test,pylint sbol3 test(10/10), andgit diff --checkpass.Prepared with Codex assistance.