'Test resolution of __typeof queries, for field in referencing
table, with no hierarchy configured'

def testTypeOfReferenceNoHierarchy(self):

    db = current.db
    uids = self.uids
    current.s3db.clear_config('typeof_hierarchy', 'hierarchy')
    resource = current.s3db.resource('typeof_hierarchy_reference')
    expr = FS('typeof_hierarchy_id').typeof(uids['HIERARCHY1-2'])
    query = expr.query(resource)
    expected = uids['HIERARCHY1-2']
    expected_query = (resource.table.typeof_hierarchy_id == expected)
    self.assertEquivalent(query, expected_query)
    expr = FS('typeof_hierarchy_id').typeof((uids['HIERARCHY1-2'], uids['HIERARCHY2-1']))
    query = expr.query(resource)
    expected = set((uids[uid] for uid in ('HIERARCHY1-2', 'HIERARCHY2-1')))
    expected_query = resource.table.typeof_hierarchy_id.belongs(expected)
    self.assertEquivalent(query, expected_query)
