textual/tests/tree/test_tree_node_parent.py
Dave Pearson 4adfe69ec9
Remove TreeNode as a pseudo-widget
This encourages importing it from `textual.widgets.tree` instead, keeping it
in line with the other changes made for #1637.

Note this is a breaking change.
2023-01-23 17:37:58 +00:00

11 lines
346 B
Python

from textual.widgets import Tree
def test_tree_node_parent() -> None:
"""It should be possible to access a TreeNode's parent."""
tree = Tree[None]("Anakin")
child = tree.root.add("Leia")
grandchild = child.add("Ben")
assert tree.root.parent is None
assert grandchild.parent == child
assert child.parent == tree.root