<s> from __future__ import absolute_import , unicode_literals <EOL> from django . test import TestCase <EOL> from wagtail . wagtailcore . models import Collection <EOL> class TestCollectionTreeOperations ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . root_collection = Collection . get_first_root_node ( ) <EOL> self . holiday_photos_collection = self . root_collection . add_child ( <EOL> name = "<STR_LIT>" <EOL> ) <EOL> self . evil_plans_collection = self . root_collection . add_child ( <EOL> name = "<STR_LIT>" <EOL> ) <EOL> def test_get_ancestors ( self ) : <EOL> self . assertEqual ( <EOL> list ( self . holiday_photos_collection . get_ancestors ( ) . order_by ( '<STR_LIT:path>' ) ) , <EOL> [ self . root_collection ] <EOL> ) <EOL> self . assertEqual ( <EOL> list ( self . holiday_photos_collection . get_ancestors ( inclusive = True ) . order_by ( '<STR_LIT:path>' ) ) , <EOL> [ self . root_collection , self . holiday_photos_collection ] <EOL> ) <EOL> def test_get_descendants ( self ) : <EOL> self . assertEqual ( <EOL> list ( self . root_collection . get_descendants ( ) . order_by ( '<STR_LIT:path>' ) ) , <EOL> [ self . holiday_photos_collection , self . evil_plans_collection ] <EOL> ) <EOL> self . assertEqual ( <EOL> list ( self . root_collection . get_descendants ( inclusive = True ) . order_by ( '<STR_LIT:path>' ) ) , <EOL> [ <EOL> self . root_collection , <EOL> self . holiday_photos_collection , <EOL> self . evil_plans_collection <EOL> ] <EOL> ) <EOL> def test_get_siblings ( self ) : <EOL> self . assertEqual ( <EOL> list ( self . holiday_photos_collection . get_siblings ( ) . order_by ( '<STR_LIT:path>' ) ) , <EOL> [ self . holiday_photos_collection , self . evil_plans_collection ] <EOL> ) <EOL> self . assertEqual ( <EOL> list ( self . holiday_photos_collection . get_siblings ( inclusive = False ) . order_by ( '<STR_LIT:path>' ) ) , <EOL> [ self . evil_plans_collection ] <EOL> ) <EOL> def test_get_next_siblings ( self ) : <EOL> self . assertEqual ( <EOL> list ( <EOL> self . holiday_photos_collection . get_next_siblings ( ) . order_by ( '<STR_LIT:path>' ) <EOL> ) , <EOL> [ self . evil_plans_collection ] <EOL> ) <EOL> self . assertEqual ( <EOL> list ( <EOL> self . holiday_photos_collection . get_next_siblings ( inclusive = True ) . order_by ( '<STR_LIT:path>' ) <EOL> ) , <EOL> [ self . holiday_photos_collection , self . evil_plans_collection ] <EOL> ) <EOL> self . assertEqual ( <EOL> list ( <EOL> self . evil_plans_collection . get_next_siblings ( ) . order_by ( '<STR_LIT:path>' ) <EOL> ) , <EOL> [ ] <EOL> ) <EOL> def test_get_prev_siblings ( self ) : <EOL> self . assertEqual ( <EOL> list ( <EOL> self . holiday_photos_collection . get_prev_siblings ( ) . order_by ( '<STR_LIT:path>' ) <EOL> ) , <EOL> [ ] <EOL> ) <EOL> self . assertEqual ( <EOL> list ( <EOL> self . evil_plans_collection . get_prev_siblings ( ) . order_by ( '<STR_LIT:path>' ) <EOL> ) , <EOL> [ self . holiday_photos_collection ] <EOL> ) <EOL> self . assertEqual ( <EOL> list ( <EOL> self . evil_plans_collection . get_prev_siblings ( inclusive = True ) . order_by ( '<STR_LIT:path>' ) <EOL> ) , <EOL> [ self . holiday_photos_collection , self . evil_plans_collection ] <EOL> ) </s>
