#NEWLINE# def test_traverse_nullable( self ) : #NEWLINE# #INDENT# with self . assertNumQueries ( 2 ) : #NEWLINE# #INDENT# qs = Employee . objects . select_related ( 'boss' ) . prefetch_related ( 'boss__serfs' ) #NEWLINE# co_serfs = [ ( list ( e . boss . serfs . all ( ) ) if ( e . boss is not None ) else [ ] ) for e in qs ] #NEWLINE# #UNINDENT# qs2 = Employee . objects . select_related ( 'boss' ) #NEWLINE# co_serfs2 = [ ( list ( e . boss . serfs . all ( ) ) if ( e . boss is not None ) else [ ] ) for e in qs2 ] #NEWLINE# self . assertEqual ( co_serfs , co_serfs2 )