MCPcopy
hub / github.com/beeware/toga / test_append_leaf

Function test_append_leaf

core/tests/sources/test_node.py:390–407  ·  view source on GitHub ↗

Appending to a leaf makes the node not a leaf any more.

(leaf_node, source)

Source from the content-addressed store, hash-verified

388
389
390def test_append_leaf(leaf_node, source):
391 """Appending to a leaf makes the node not a leaf any more."""
392 new_child = leaf_node.append({"val1": "new"})
393
394 # Leaf node isn't a leaf any more
395 assert leaf_node.can_have_children()
396 assert len(leaf_node) == 1
397 assert leaf_node[0] == new_child
398
399 # A child node was created using the source's factory
400 source._create_node.assert_called_with(
401 parent=leaf_node, data={"val1": "new"}, children=None
402 )
403
404 # insert notification was sent, the change is associated with the new item
405 source.notify.assert_called_once_with(
406 "insert", parent=leaf_node, index=0, item=leaf_node[0]
407 )
408
409
410def test_index(node, child_b):

Callers

nothing calls this directly

Calls 2

appendMethod · 0.45
can_have_childrenMethod · 0.45

Tested by

no test coverage detected