Appending to a leaf makes the node not a leaf any more.
(leaf_node, source)
| 388 | |
| 389 | |
| 390 | def 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 | |
| 410 | def test_index(node, child_b): |
nothing calls this directly
no test coverage detected