Add an insert method to the NodeList

This commit is contained in:
Dave Pearson
2022-11-01 22:26:38 +00:00
parent e35d146445
commit 016f7be83a
2 changed files with 21 additions and 0 deletions

View File

@@ -21,6 +21,16 @@ def test_repeat_add_one():
nodes._append(widget)
assert len(nodes)==1
def test_insert():
nodes = NodeList()
widget1 = Widget()
widget2 = Widget()
widget3 = Widget()
nodes._append(widget1)
nodes._append(widget3)
nodes._insert(1,widget2)
assert list(nodes) == [widget1,widget2,widget3]
def test_truthy():
"""Does a node list act as a truthy object?"""
nodes = NodeList()