'Test airegex-queries as part of a complex query'

def testComplex(self):

    self.airegex(True)
    assertEqual = self.assertEqual
    assertTrue = self.assertTrue
    query = (FS('uuid').belongs(('TEST0', 'TEST1', 'TEST2')) & (FS('name').like('%e\xc3\xb1') | FS('name').like('Man%')))
    expected = ('TEST1', 'TEST2')
    resource = current.s3db.resource('airegex_test', filter=query)
    rows = resource.select(['uuid', 'name'], as_rows=True)
    assertEqual(len(rows), len(expected))
    for row in rows:
        assertTrue((row.uuid in expected))
