def test_adding_to_an_empty_tree(): tree = Tree() p = Path(tree) p.hello = sentinel.hello p.animals.badger = sentinel.badger p.animals.weasel = sentinel.weasel p.animals.stoat = sentinel.stoat assert sorted(walk(tree)) == sorted([(('hello',), sentinel.hello), (('animals', 'badger'), sentinel.badger), (('animals', 'weasel'), sentinel.weasel), (('animals', 'stoat'), sentinel.stoat), ])
def test_adding_to_an_existing_tree(example_tree): pre_exisiting = list(walk(example_tree)) p = Path(example_tree) p.hello = sentinel.hello p.animals.badger = sentinel.badger p.animals.weasel = sentinel.weasel p.animals.stoat = sentinel.stoat assert sorted(walk(example_tree)) == sorted(pre_exisiting + [(('hello',), sentinel.hello), (('animals', 'badger'), sentinel.badger), (('animals', 'weasel'), sentinel.weasel), (('animals', 'stoat'), sentinel.stoat), ])