#NEWLINE# def test_div3_extract( self ) : #NEWLINE# #INDENT# with register_lookup ( models . IntegerField , Div3Transform ) : #NEWLINE# #INDENT# a1 = Author . objects . create ( name = 'a1' , age = 1 ) #NEWLINE# a2 = Author . objects . create ( name = 'a2' , age = 2 ) #NEWLINE# a3 = Author . objects . create ( name = 'a3' , age = 3 ) #NEWLINE# a4 = Author . objects . create ( name = 'a4' , age = 4 ) #NEWLINE# baseqs = Author . objects . order_by ( 'name' ) #NEWLINE# self . assertQuerysetEqual ( baseqs . filter ( age__div3 = 2 ) , [ a2 ] , ( lambda x : x ) ) #NEWLINE# self . assertQuerysetEqual ( baseqs . filter ( age__div3__lte = 3 ) , [ a1 , a2 , a3 , a4 ] , ( lambda x : x ) ) #NEWLINE# self . assertQuerysetEqual ( baseqs . filter ( age__div3__in = [ 0 , 2 ] ) , [ a2 , a3 ] , ( lambda x : x ) ) #NEWLINE# self . assertQuerysetEqual ( baseqs . filter ( age__div3__in = [ 2 , 4 ] ) , [ a2 ] , ( lambda x : x ) ) #NEWLINE# self . assertQuerysetEqual ( baseqs . filter ( age__div3__gte = 3 ) , [ ] , ( lambda x : x ) ) #NEWLINE# self . assertQuerysetEqual ( baseqs . filter ( age__div3__range = ( 1 , 2 ) ) , [ a1 , a2 , a4 ] , ( lambda x : x ) )