#NEWLINE# def testTypeOfLookupTableReference( self ) : #NEWLINE# #INDENT# '\n            Test resolution of __typeof queries, for reference field\n            in lookup table\n        ' #NEWLINE# db = current . db #NEWLINE# uids = self . uids #NEWLINE# lookup_uids = self . lookup_uids #NEWLINE# resource = current . s3db . resource ( 'typeof_hierarchy_reference' ) #NEWLINE# lookup = lookup_uids [ 'NONHIERARCHY1' ] #NEWLINE# expr = FS ( 'typeof_hierarchy_id$typeof_nonhierarchy_id' ) . typeof ( lookup ) #NEWLINE# query = expr . query ( resource ) #NEWLINE# table = table . typeof_hierarchy #NEWLINE# expected = set ( ( uids [ uid ] for uid in ( 'HIERARCHY1-1' , 'HIERARCHY1-1-1' , 'HIERARCHY1-1-2' ) ) ) #NEWLINE# expected_query = table . id . belongs ( expected ) #NEWLINE# lookup = ( lookup_uids [ 'NONHIERARCHY1' ] , lookup_uids [ 'NONHIERARCHY2' ] ) #NEWLINE# expr = FS ( 'typeof_hierarchy_id$typeof_nonhierarchy_id' ) . typeof ( lookup ) #NEWLINE# query = expr . query ( resource ) #NEWLINE# table = db . typeof_hierarchy #NEWLINE# expected = set ( ( uids [ uid ] for uid in ( 'HIERARCHY1-1' , 'HIERARCHY1-1-1' , 'HIERARCHY1-1-2' ) ) ) #NEWLINE# expected_query = table . id . belongs ( expected ) #NEWLINE# self . assertEquivalent ( query , expected_query )