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

def testTypeOfLookupTableNoHierarchy(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$name').typeof('Type    1-2')
    query = expr.query(resource)
    table = db.typeof_hierarchy
    expected_query = (table.name == 'Type    1-2')
    self.assertEquivalent(query, expected_query)
    expr = FS('typeof_hierarchy_id$name').typeof(('Type    1-2', 'Type    2-1'))
    query = expr.query(resource)
    table = db.typeof_hierarchy
    expected_query = table.name.belongs(('Type    1-2', 'Type    2-1'))
    self.assertEquivalent(query, expected_query)
    expr = FS('typeof_hierarchy_id$name').typeof(('Type    1-*', 'Type    2-1'))
    query = expr.query(resource)
    table = db.typeof_hierarchy
    expected_query = (table.name.like('Type    1-%') | (table.name == 'Type    2-1'))
    self.assertEquivalent(query, expected_query)
