#NEWLINE# def _assertEqualsAndSerialize( self , expected , kranges ) : #NEWLINE# #INDENT# results = [ ] #NEWLINE# while True : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# results . append ( kranges . next ( ) ) #NEWLINE# kranges = kranges . __class__ . from_json ( kranges . to_json ( ) ) #NEWLINE# #UNINDENT# except StopIteration : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# self . assertRaises ( StopIteration , kranges . next ) #NEWLINE# expected . sort ( ) #NEWLINE# results . sort ( ) #NEWLINE# self . assertEquals ( expected , results )