def tree_with_some_nodes(): t = Tree() t.append(Node('foo')) t.append(Node('bar')) t.append(Node('baz')) t[0].append(Node('sub1')) t[0].append(Node('sub2')) return t
def test_select_none_node(): # setting selected_node to None clears the selection t = Tree() t.selected_node = None eq_(t.selected_nodes, [])
def test_select_none_path(): # setting selected_path to None clears the selection t = Tree() t.selected_path = None assert t.selected_path is None
def test_find_none(): # when find() yields no result, return None t = Tree() assert t.find(lambda n: False) is None # no StopIteration exception