A new root node can be appended.
(source, listener)
| 553 | |
| 554 | |
| 555 | def test_append(source, listener): |
| 556 | """A new root node can be appended.""" |
| 557 | new_child = source.append({"val1": "new"}) |
| 558 | |
| 559 | # Source has one more root. |
| 560 | assert len(source) == 3 |
| 561 | assert source[2] == new_child |
| 562 | |
| 563 | # Root data is as expected |
| 564 | assert source[2].val1 == "new" |
| 565 | |
| 566 | # Insert notification was sent, the change is associated with the new item |
| 567 | listener.source_insert.assert_called_once_with( |
| 568 | parent=None, |
| 569 | index=2, |
| 570 | item=new_child, |
| 571 | ) |
| 572 | |
| 573 | |
| 574 | def test_append_with_children(source, listener): |