#NEWLINE# def test_first( self ) : #NEWLINE# #INDENT# p1 = Person . objects . create ( name = 'Bob' , birthday = datetime ( 1950 , 1 , 1 ) ) #NEWLINE# p2 = Person . objects . create ( name = 'Alice' , birthday = datetime ( 1961 , 2 , 3 ) ) #NEWLINE# self . assertEqual ( Person . objects . first ( ) , p1 ) #NEWLINE# self . assertEqual ( Person . objects . order_by ( 'name' ) . first ( ) , p2 ) #NEWLINE# self . assertEqual ( Person . objects . filter ( birthday__lte = datetime ( 1955 , 1 , 1 ) ) . first ( ) , self ) #NEWLINE# self . assertIs ( Person . objects . filter ( birthday__lte = datetime ( 1940 , 1 , 1 ) ) . first ( ) , None )