#NEWLINE# def test_set_consolidation_rosettacode( ) : #NEWLINE# #INDENT# def list_of_sets_equal( result , solution ) : #NEWLINE# #INDENT# assert_equal ( { frozenset ( s ) for s in result } , { frozenset ( s ) for s in solution } ) #NEWLINE# #UNINDENT# question = [ { 'A' , 'B' } , { 'C' , 'D' } ] #NEWLINE# solution = [ { 'A' , 'B' } , { 'C' , 'D' } ] #NEWLINE# list_of_sets_equal ( _consolidate ( question , 1 ) , solution ) #NEWLINE# question = [ { 'A' , 'B' } , { 'B' , 'C' } ] #NEWLINE# solution = [ { 'A' , 'B' , 'C' } ] #NEWLINE# list_of_sets_equal ( _consolidate ( question , 1 ) , solution ) #NEWLINE# question = [ { 'A' , 'B' } , { 'C' , 'D' } , { 'D' , 'B' } ] #NEWLINE# solution = [ { 'A' , 'C' , 'B' , 'D' } ] #NEWLINE# list_of_sets_equal ( _consolidate ( question , 1 ) , solution ) #NEWLINE# question = [ { 'H' , 'I' , 'K' } , { 'A' , 'B' } , { 'C' , 'D' } , { 'D' , 'B' } , { 'F' , 'G' , 'H' } ] #NEWLINE# solution = [ { 'A' , 'C' , 'B' , 'D' } , { 'G' , 'F' , 'I' , 'H' , 'K' } ] #NEWLINE# list_of_sets_equal ( _consolidate ( question , 1 ) , solution ) #NEWLINE# question = [ { 'A' , 'H' } , { 'H' , 'I' , 'K' } , { 'A' , 'B' } , { 'C' , 'D' } , { 'D' , 'B' } , { 'F' , 'G' , 'H' } ] #NEWLINE# solution = [ { 'A' , 'C' , 'B' , 'D' , 'G' , 'F' , 'I' , 'H' , 'K' } ] #NEWLINE# list_of_sets_equal ( _consolidate ( question , 1 ) , list_of_sets_equal ) #NEWLINE# question = [ { 'H' , 'I' , 'K' } , { 'A' , 'B' } , { 'C' , 'D' } , { 'D' , 'B' } , { 'F' , 'G' , 'H' } , { 'A' , 'H' } ] #NEWLINE# solution = [ { 'A' , 'C' , 'B' , 'D' , 'G' , 'F' , 'I' , 'H' , 'K' } ] #NEWLINE# list_of_sets_equal ( _consolidate ( question , 1 ) , solution )