#NEWLINE# @ unittest . skipUnless ( ( connection . vendor == 'postgresql' ) , 'PostgreSQL specific SQL used' ) #NEWLINE# def test_birthdate_month( self ) : #NEWLINE# #INDENT# a1 = Author . objects . create ( name = 'a1' , birthdate = date ( 1981 , 2 , 16 ) ) #NEWLINE# a2 = Author . objects . create ( name = 'a2' , birthdate = date ( 2012 , 2 , 29 ) ) #NEWLINE# a3 = Author . objects . create ( name = 'a3' , birthdate = date ( 2012 , 1 , 31 ) ) #NEWLINE# a4 = Author . objects . create ( name = 'a4' , birthdate = date ( 2012 , 3 , 1 ) ) #NEWLINE# with register_lookup ( models . DateField , InMonth ) : #NEWLINE# #INDENT# self . assertQuerysetEqual ( Author . objects . filter ( birthdate__inmonth = date ( 2012 , 1 , 15 ) ) , [ a3 ] , ( lambda x : x ) ) #NEWLINE# self . assertQuerysetEqual ( Author . objects . filter ( birthdate__inmonth = date ( 2012 , 2 , 1 ) ) , [ a2 ] , ( lambda x : x ) ) #NEWLINE# self . assertQuerysetEqual ( Author . objects . filter ( birthdate__inmonth = date ( 1981 , 2 , 28 ) ) , [ a1 ] , ( lambda x : x ) ) #NEWLINE# self . assertQuerysetEqual ( Author . objects . filter ( birthdate__inmonth = date ( 2012 , 3 , 12 ) ) , [ a4 ] , ( lambda x : x ) ) #NEWLINE# self . assertQuerysetEqual ( Author . objects . filter ( birthdate__inmonth = date ( 2012 , 4 , 1 ) ) , [ ] , ( lambda x : x ) )