def test_add_two_children(self): node = Note(5) child0 = Node(parent=node) child1 = Node(parent=node) node.add_child(child0) node.add_child(child1) self.assertIs(node.children[0], child0) self.assertIs(node.children[1], child1)
def test_add_one_child(self): node = Note(5) child = Node(parent=node) node.add_child(child) self.assertIs(node.children[0], child)
def test_repr(self): node = Note(5) actual = repr(node) expected = "Note(5, children=[])" self.assertEqual(expected, actual)
def test_create(self): node = Note(5) self.assertEqual(node.indent, 5) self.assertEqual(node.lines, []) self.assertIsNone(node.parent)