#NEWLINE# def test_values_from_lookup_field( self ) : #NEWLINE# #INDENT# '\n        Regression test for #12654: lookup_field\n        ' #NEWLINE# SITE_NAME = 'example.com' #NEWLINE# TITLE_TEXT = 'Some title' #NEWLINE# CREATED_DATE = datetime . min #NEWLINE# ADMIN_METHOD = 'admin method' #NEWLINE# SIMPLE_FUNCTION = 'function' #NEWLINE# INSTANCE_ATTRIBUTE = 'attr' #NEWLINE# class MockModelAdmin ( object ) : #NEWLINE# #INDENT# def get_admin_value( self , obj ) : #NEWLINE# #INDENT# return ADMIN_METHOD #NEWLINE# #UNINDENT# #UNINDENT# simple_function = ( lambda obj : SIMPLE_FUNCTION ) #NEWLINE# article = Article ( site = Site ( domain = SITE_NAME ) , title = TITLE_TEXT , created = CREATED_DATE ) #NEWLINE# article . non_field = INSTANCE_ATTRIBUTE #NEWLINE# verifications = ( ( 'site' , SITE_NAME ) , ( 'created' , localize ( CREATED_DATE ) ) , ( 'title' , TITLE_TEXT ) , ( 'get_admin_value' , ADMIN_METHOD ) , ( simple_function , SIMPLE_FUNCTION ) , ( 'test_from_model' , article . test_from_model ( ) ) , ( 'non_field' , INSTANCE_ATTRIBUTE ) ) #NEWLINE# mock_admin = MockModelAdmin ( ) #NEWLINE# for ( name , value ) in verifications : #NEWLINE# #INDENT# ( field , attr , resolved_value ) = lookup_field ( name , article , mock_admin ) #NEWLINE# if ( field is not None ) : #NEWLINE# #INDENT# resolved_value = display_for_field ( resolved_value , field ) #NEWLINE# #UNINDENT# self . assertEqual ( value , resolved_value )