def test_mindmap_as_lines_with_tabs(): node_1 = Node(raw_text='Node 1') node_1_1 = Node(raw_text='Node 1.1') node_1_1_1 = Node(raw_text='Node 1.1.1') node_1.add_child(node_1_1) node_1_1.add_child(node_1_1_1) mindmap = MindMap([node_1]) expected_lines = ['Node 1', '\tNode 1.1', '\t\tNode 1.1.1'] assert mindmap.as_lines(indent='\t') == expected_lines
def test_create_children_based_on_lines_2(): node_1 = Node(raw_text='Node 1') raw_lines = ['\tNode 1.1', '\t\tNode 1.1.1', '\t\tNode 1.1.2', '\tNode 1.2', '\tNode 1.3'] node_1.add_children_based_on_lines(raw_lines) expected_lines = ['Node 1', ' Node 1.1', ' Node 1.1.1', ' Node 1.1.2', ' Node 1.2', ' Node 1.3'] actual_lines = [] node_1.add_self_to_lines(actual_lines) assert_lines_equal(actual_lines, expected_lines)
def test_create_mindmap(): node_1 = Node(raw_text='Node 1') node_2 = Node(raw_text='Node 2') mindmap = MindMap([node_1, node_2]) assert mindmap.root_nodes == [node_1, node_2]
def test_mindmap_as_lines(): node_1 = Node(raw_text='Node 1') node_1_1 = Node(raw_text='Node 1.1') node_1_1_1 = Node(raw_text='Node 1.1.1') node_1_1_2 = Node(raw_text='Node 1.1.2') node_1_2 = Node(raw_text='Node 1.2') node_2 = Node(raw_text='Node 2') node_2_1 = Node(raw_text='Node 2.1') node_2_1_1 = Node(raw_text='Node 2.1.1') node_1.add_child(node_1_1) node_1_1.add_child(node_1_1_1) node_1_1.add_child(node_1_1_2) node_1.add_child(node_1_2) node_2.add_child(node_2_1) node_2_1.add_child(node_2_1_1) mindmap = MindMap([node_1, node_2]) expected_lines = ['Node 1', ' Node 1.1', ' Node 1.1.1', ' Node 1.1.2', ' Node 1.2', 'Node 2', ' Node 2.1', ' Node 2.1.1'] assert mindmap.as_lines() == expected_lines
def test_create_node(): node = Node(raw_text='Node 1') assert node.raw_text == 'Node 1' assert node.children == []
def test_add_self_to_lines(): node_1 = Node(raw_text='Node 1') node_1_1 = Node(raw_text='Node 1.1') node_1_1_1 = Node(raw_text='Node 1.1.1') node_1_1_2 = Node(raw_text='Node 1.1.2') node_1_2 = Node(raw_text='Node 1.2') node_1.add_child(node_1_1) node_1_1.add_child(node_1_1_1) node_1_1.add_child(node_1_1_2) node_1.add_child(node_1_2) expected_lines = ['Node 1', ' Node 1.1', ' Node 1.1.1', ' Node 1.1.2', ' Node 1.2'] actual_lines = [] node_1.add_self_to_lines(actual_lines) assert_lines_equal(actual_lines, expected_lines)
def test_add_child(): node_1 = Node(raw_text='Node *1*') node_1_1 = Node(raw_text='Node *1.1*') new_child = node_1.add_child(node_1_1) assert node_1.children == [node_1_1] assert new_child == node_1_1