示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 def test_add_one_child(self):
     node = Note(5)
     child = Node(parent=node)
     node.add_child(child)
     self.assertIs(node.children[0], child)
示例#4
0
 def test_repr(self):
     node = Note(5)
     actual = repr(node)
     expected = "Note(5, children=[])"
     self.assertEqual(expected, actual)
示例#5
0
 def test_add_one_child(self):
     node = Note(5)
     child = Node(parent=node)
     node.add_child(child)
     self.assertIs(node.children[0], child)
示例#6
0
 def test_create(self):
     node = Note(5)
     self.assertEqual(node.indent, 5)
     self.assertEqual(node.lines, [])
     self.assertIsNone(node.parent)