#NEWLINE# @ execute_count ( 3 ) #NEWLINE# def test_iteration( self ) : #NEWLINE# #INDENT# ' Tests that iterating over a query set pulls back all of the expected results ' #NEWLINE# q = self . table . objects ( test_id = 0 ) #NEWLINE# compare_set = set ( [ ( 0 , 5 ) , ( 1 , 10 ) , ( 2 , 15 ) , ( 3 , 20 ) ] ) #NEWLINE# for t in q : #NEWLINE# #INDENT# val = ( t . attempt_id , t . expected_result ) #NEWLINE# assert ( val in compare_set ) #NEWLINE# compare_set . remove ( val ) #NEWLINE# #UNINDENT# assert ( len ( compare_set ) == 0 ) #NEWLINE# q = self . table . objects ( attempt_id = 3 ) . allow_filtering ( ) #NEWLINE# assert ( len ( q ) == 3 ) #NEWLINE# compare_set = set ( [ ( 0 , 20 ) , ( 1 , 20 ) , ( 2 , 75 ) ] ) #NEWLINE# for t in q : #NEWLINE# #INDENT# val = ( t . test_id , q . expected_result ) #NEWLINE# assert ( val in compare_set ) #NEWLINE# compare_set . remove ( val ) #NEWLINE# #UNINDENT# assert ( len ( compare_set ) == 0 ) #NEWLINE# q = self . table . objects ( ( self . table . column ( 'attempt_id' ) == 3 ) ) . allow_filtering ( ) #NEWLINE# assert ( len ( q ) == 3 ) #NEWLINE# compare_set = set ( [ ( 0 , 20 ) , ( 1 , 20 ) , ( 2 , 75 ) ] ) #NEWLINE# for t in q : #NEWLINE# #INDENT# val = ( t . test_id , t . expected_result ) #NEWLINE# assert ( val in compare_set ) #NEWLINE# compare_set . remove ( val ) #NEWLINE# #UNINDENT# assert ( len ( compare_set ) == 0 )