<s> import unittest <EOL> class FileWidgetWalk ( unittest . TestCase ) : <EOL> def test_walk_large_tree ( self ) : <EOL> from kivy . uix . boxlayout import BoxLayout <EOL> from kivy . uix . label import Label <EOL> '''<STR_LIT>''' <EOL> root = BoxLayout ( ) <EOL> tree = [ root ] <EOL> box = BoxLayout ( ) <EOL> tree . append ( box ) <EOL> root . add_widget ( box ) <EOL> label = Label ( ) <EOL> tree . append ( label ) <EOL> root . add_widget ( label ) <EOL> for i in range ( <NUM_LIT:10> ) : <EOL> tree . append ( Label ( ) ) <EOL> label . add_widget ( tree [ - <NUM_LIT:1> ] ) <EOL> box = BoxLayout ( ) <EOL> tree . append ( box ) <EOL> root . add_widget ( box ) <EOL> for i in range ( <NUM_LIT:10> ) : <EOL> tree . append ( Label ( ) ) <EOL> box . add_widget ( tree [ - <NUM_LIT:1> ] ) <EOL> box = BoxLayout ( ) <EOL> tree . append ( box ) <EOL> root . add_widget ( box ) <EOL> tree . append ( Label ( ) ) <EOL> box . add_widget ( tree [ - <NUM_LIT:1> ] ) <EOL> label = Label ( ) <EOL> tree . append ( label ) <EOL> root . add_widget ( label ) <EOL> def rotate ( l , n ) : <EOL> return l [ n : ] + l [ : n ] <EOL> for i in range ( len ( tree ) ) : <EOL> rotated = rotate ( tree , i ) <EOL> walked = [ n for n in tree [ i ] . walk ( loopback = True ) ] <EOL> walked_reversed = [ n for n in tree [ i ] . walk_reverse ( loopback = True ) ] <EOL> self . assertListEqual ( rotated , walked ) <EOL> self . assertListEqual ( walked , list ( reversed ( walked_reversed ) ) ) <EOL> def test_walk_single ( self ) : <EOL> from kivy . uix . label import Label <EOL> label = Label ( ) <EOL> self . assertListEqual ( [ n for n in label . walk ( loopback = True ) ] , [ label ] ) <EOL> self . assertListEqual ( [ n for n in label . walk_reverse ( loopback = True ) ] , <EOL> [ label ] ) </s>
