Skip to content

Fix (and test) parent-child relationships#66

Merged
gselzer merged 2 commits intopyapp-kit:mainfrom
gselzer:node-parenting
Apr 15, 2026
Merged

Fix (and test) parent-child relationships#66
gselzer merged 2 commits intopyapp-kit:mainfrom
gselzer:node-parenting

Conversation

@gselzer
Copy link
Copy Markdown
Collaborator

@gselzer gselzer commented Apr 15, 2026

The main fix here is that passing the parent kwarg to a Node constructor wasn't actually setting the parent. The rest of the tests are just nice to have.

gselzer added 2 commits April 15, 2026 09:50
The main fix here is that passing the parent kwarg to a Node constructor
wasn't actually setting the parent. The rest of the tests are just
nice to have.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes parent/child bookkeeping in the scene graph by ensuring parent= passed at node construction time results in a consistent parent→children relationship, and adds targeted tests around the Node relationship API.

Changes:

  • Add tests/model/_nodes/test_node.py covering add/remove child behavior, constructor children= and parent= kwargs, reparenting, and __contains__.
  • Update Node.__init__ to synchronize parent→children when parent is provided via kwargs.
  • Prevent duplicate additions in Node.add_child, and simplify removal typing in _update_parent_children.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/model/_nodes/test_node.py New tests validating parent/child invariants, signal emission, and reparenting behavior.
src/scenex/model/_nodes/node.py Fix constructor-time parent= handling; add dedupe logic in add_child; adjust _update_parent_children removal.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/scenex/model/_nodes/node.py
Comment thread src/scenex/model/_nodes/node.py
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.38%. Comparing base (d8da025) to head (96aacdc).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #66      +/-   ##
==========================================
+ Coverage   88.13%   88.38%   +0.24%     
==========================================
  Files          62       62              
  Lines        2950     3064     +114     
==========================================
+ Hits         2600     2708     +108     
- Misses        350      356       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gselzer gselzer merged commit 6e10ae7 into pyapp-kit:main Apr 15, 2026
40 checks passed
@gselzer gselzer deleted the node-parenting branch April 15, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants