@@ -268,40 +268,31 @@ Returns a list containing the ancestors and the node itself in tree order.
268268
269269 for item in categories:
270270 print(item)
271- print(item.path_to_root()[-1]) # get root
272- # last element in list
273271 pprint(item.path_to_root().all())
274272 print()
275273
276274.. testoutput ::
277275 :options: +NORMALIZE_WHITESPACE
278276
279- <Category root>
280277 <Category root>
281278 [<Category root>]
282279
283280 <Category foo>
284- <Category root>
285281 [<Category foo>, <Category root>]
286282
287283 <Category bar>
288- <Category root>
289284 [<Category bar>, <Category foo>, <Category root>]
290285
291286 <Category baz>
292- <Category root>
293287 [<Category baz>, <Category bar>, <Category foo>, <Category root>]
294288
295289 <Category foo1>
296- <Category root>
297290 [<Category foo1>, <Category root>]
298291
299292 <Category bar1>
300- <Category root>
301293 [<Category bar1>, <Category foo1>, <Category root>]
302294
303295 <Category baz1>
304- <Category root>
305296 [<Category baz1>, <Category foo1>, <Category root>]
306297
307298Full code
@@ -423,37 +414,29 @@ Full code
423414
424415 for item in categories:
425416 print(item)
426- print(item.path_to_root()[-1])
427417 pprint(item.path_to_root().all())
428418 print()
429419
430420 '''
431421 <Category root>
432- <Category root>
433422 [<Category root>]
434423
435424 <Category foo>
436- <Category root>
437425 [<Category foo>, <Category root>]
438426
439427 <Category bar>
440- <Category root>
441428 [<Category bar>, <Category foo>, <Category root>]
442429
443430 <Category baz>
444- <Category root>
445431 [<Category baz>, <Category bar>, <Category foo>, <Category root>]
446432
447433 <Category foo1>
448- <Category root>
449434 [<Category foo1>, <Category root>]
450435
451436 <Category bar1>
452- <Category root>
453437 [<Category bar1>, <Category foo1>, <Category root>]
454438
455439 <Category baz1>
456- <Category root>
457440 [<Category baz1>, <Category foo1>, <Category root>]
458441 '''
459442
@@ -491,30 +474,23 @@ Full code
491474 <Category baz1>
492475 [{'node': <Category baz1>}]
493476
494- <Category root>
495477 <Category root>
496478 [<Category root>]
497479
498480 <Category foo>
499- <Category root>
500481 [<Category foo>, <Category root>]
501482
502483 <Category bar>
503- <Category root>
504484 [<Category bar>, <Category foo>, <Category root>]
505485
506486 <Category baz>
507- <Category root>
508487 [<Category baz>, <Category bar>, <Category foo>, <Category root>]
509488
510489 <Category foo1>
511- <Category root>
512490 [<Category foo1>, <Category root>]
513491
514492 <Category bar1>
515- <Category root>
516493 [<Category bar1>, <Category foo1>, <Category root>]
517494
518495 <Category baz1>
519- <Category root>
520496 [<Category baz1>, <Category foo1>, <Category root>]
0 commit comments