'Test resolution of __typeof queries, for list:reference,
with None value'

def testTypeOfListReferenceNone(self):

    db = current.db
    adapter = self.adapter
    uids = self.uids
    resource = current.s3db.resource('typeof_hierarchy_reference')
    expr = FS('typeof_hierarchy_multi_id').typeof(None)
    query = expr.query(resource)
    table = resource.table
    expected_query = table.id.belongs(set())
    self.assertEquivalent(query, expected_query)
    expr = FS('typeof_hierarchy_multi_id').typeof([None])
    query = expr.query(resource)
    expected_query = table.id.belongs(set())
    self.assertEquivalent(query, expected_query)
    expr = FS('typeof_hierarchy_multi_id').typeof((None, uids['HIERARCHY2-1']))
    query = expr.query(resource)
    expected = set((uids[uid] for uid in ('HIERARCHY2-1', 'HIERARCHY2-1-1', 'HIERARCHY2-1-2')))
    found = self.inspect_multi_query(query, field=table.typeof_hierarchy_multi_id, conjunction=adapter.OR, op=adapter.CONTAINS)
    self.assertEqual(found, expected)
