Files
textual/tests/tree/test_tree_node_parent.py
2023-01-05 10:35:25 +00:00

11 lines
355 B
Python

from textual.widgets import TreeNode, 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