#NEWLINE# def test_convert_by_lookup_multi( self ) : #NEWLINE# #INDENT# 'Establish that if doing a foreign key lookup returns multiple\n        results, that we return a special error.\n        ' #NEWLINE# p = click . Option ( ( 'name' , '-n' ) ) #NEWLINE# with client . test_mode as t : #NEWLINE# #INDENT# t . register_json ( '/users/?username=meagan' , { #NEWLINE# #INDENT# 'count' : 2 , #NEWLINE# 'results' : [ { #NEWLINE# #INDENT# 'id' : 42 , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'id' : 84 , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# with self . assertRaises ( exc . MultipleRelatedError ) : #NEWLINE# #INDENT# self . assertEqual ( self . related . convert ( 'meagan' , p , None ) , 42 )