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.
11 lines
346 B
Python
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
|