#NEWLINE# def test_flatten( self ) : #NEWLINE# #INDENT# flatten = luigi . task . flatten #NEWLINE# self . assertEqual ( sorted ( flatten ( { #NEWLINE# #INDENT# 'a' : 'foo' , #NEWLINE# 'b' : 'bar' , #NEWLINE# #UNINDENT# } ) ) , [ 'bar' , 'foo' ] ) #NEWLINE# self . assertEqual ( sorted ( flatten ( [ 'foo' , [ 'bar' , 'troll' ] ] ) ) , [ 'bar' , 'foo' , 'troll' ] ) #NEWLINE# self . assertEqual ( flatten ( 'foo' ) , [ 'foo' ] ) #NEWLINE# self . assertEqual ( flatten ( 42 ) , [ 42 ] ) #NEWLINE# self . assertEqual ( flatten ( ( len ( i ) for i in [ 'foo' , 'troll' ] ) ) , [ 3 , 5 ] ) #NEWLINE# self . assertRaises ( TypeError , i , ( len ( i ) for i in [ 'foo' , 'troll' , None ] ) )