• Home
  • Raw
  • Download

Lines Matching refs:n1

98         n1 = pytree.Node(1000, [l1, l2])
99 self.assertEqual(n1.type, 1000)
100 self.assertEqual(n1.children, [l1, l2])
105 n1 = pytree.Node(1000, [l1, l2])
106 self.assertEqual(repr(n1),
112 n1 = pytree.Node(1000, [l1, l2])
113 self.assertEqual(str(n1), "foo bar")
118 n1 = pytree.Node(1000, [l1])
119 self.assertEqual(n1.prefix, "")
120 n1.prefix = " "
121 self.assertEqual(n1.prefix, " ")
127 n1 = pytree.Node(1000, [l1, l2])
131 self.assertEqual(n1.get_suffix(), "")
134 n2 = pytree.Node(1000, [n1, l3])
136 self.assertEqual(n1.get_suffix(), l3.prefix)
141 n1 = pytree.Node(1000, ())
143 self.assertEqual(n1, n2)
145 self.assertNotEqual(n1, n3)
150 n1 = pytree.Node(1000, [l1])
152 self.assertEqual(n1, n2)
155 self.assertNotEqual(n1, n3)
161 n1 = pytree.Node(1000, [l1, l2, l3])
162 self.assertEqual(n1.children, [l1, l2, l3])
163 self.assertIsInstance(n1.children, list)
164 self.assertFalse(n1.was_changed)
167 self.assertEqual(n1.children, [l1, l2new, l3])
168 self.assertIsInstance(n1.children, list)
169 self.assertTrue(n1.was_changed)
175 n1 = pytree.Node(1000, [l1, l2, l3])
178 self.assertEqual(str(n1), "foo**bar")
179 self.assertIsInstance(n1.children, list)
187 n1 = pytree.Node(1000, [n2, n3])
189 self.assertEqual(list(n1.leaves()), [l1, l2, l3])
196 n1 = pytree.Node(1000, [n2, n3])
200 self.assertEqual(n1.depth(), 0)
207 n1 = pytree.Node(1000, [c1, l3])
208 self.assertEqual(list(n1.post_order()), [l1, l2, c1, l3, n1])
215 n1 = pytree.Node(1000, [c1, l3])
216 self.assertEqual(list(n1.pre_order()), [n1, c1, l1, l2, l3])
225 n1 = pytree.Node(1000, [l1])
226 self.assertFalse(n1.was_changed)
227 n1.changed()
228 self.assertTrue(n1.was_changed)
233 n1 = pytree.Node(1000, [l1, l2, l3])
234 n2 = pytree.Node(1000, [n1])
236 self.assertFalse(n1.was_changed)
239 n1.changed()
240 self.assertTrue(n1.was_changed)
254 n1 = pytree.Node(1000, [l1, l2], prefix=prefix)
255 self.assertTrue(str(n1), prefix + "self_foo")
256 self.assertEqual(n1.prefix, prefix)
263 n1 = pytree.Node(1000, [l1, l2])
264 n2 = pytree.Node(1000, [n1])
266 self.assertEqual(n1.remove(), 0)
268 self.assertEqual(l1.parent, n1)
269 self.assertEqual(n1.parent, None)
271 self.assertFalse(n1.was_changed)
276 self.assertEqual(n1.children, [])
278 self.assertEqual(n1.parent, None)
280 self.assertTrue(n1.was_changed)
284 n1 = pytree.Node(1000, [])
285 n1.remove()
286 self.assertEqual(n1.parent, None)
294 n1 = pytree.Node(1000, [l1])
297 n1.set_child(0, l2)
299 self.assertEqual(l2.parent, n1)
300 self.assertEqual(n1.children, [l2])
303 n2.set_child(0, n1)
305 self.assertEqual(n1.parent, n2)
307 self.assertEqual(n2.children, [n1])
309 self.assertRaises(IndexError, n1.set_child, 4, l2)
311 self.assertRaises(Exception, n1.set_child, 0, list)
315 n1 = pytree.Node(1000, [l1])
318 n1.insert_child(0, l2)
319 self.assertEqual(l2.parent, n1)
320 self.assertEqual(n1.children, [l2, l1])
323 n1.insert_child(2, l3)
324 self.assertEqual(n1.children, [l2, l1, l3])
327 self.assertRaises(Exception, n1.insert_child, 0, list)
330 n1 = pytree.Node(1000, [])
333 n1.append_child(l1)
334 self.assertEqual(l1.parent, n1)
335 self.assertEqual(n1.children, [l1])
338 n1.append_child(l2)
339 self.assertEqual(l2.parent, n1)
340 self.assertEqual(n1.children, [l1, l2])
343 self.assertRaises(Exception, n1.append_child, list)
346 n1 = pytree.Node(1000, [])
348 p1 = pytree.Node(1000, [n1, n2])
350 self.assertIs(n1.next_sibling, n2)
364 n1 = pytree.Node(1000, [])
366 p1 = pytree.Node(1000, [n1, n2])
368 self.assertIs(n2.prev_sibling, n1)
369 self.assertEqual(n1.prev_sibling, None)
391 n1 = pytree.Node(1000, [l1, l2])
393 root = pytree.Node(1000, [n1, n2])
399 self.assertFalse(pl.match(n1, results=r))
412 self.assertFalse(pn.match(n1, results=r))
427 n1 = pytree.Node(1000, [l1, l2])
429 root = pytree.Node(1000, [n1, n2])
437 self.assertFalse(pw.match_seq([n1], r))