'Test combinations of web2py Queries with virtual field filter'

@unittest.skipIf((not current.deployment_settings.has_module('project')), 'project    module    disabled')
def testGetQueryMixedQueryTypeVirtual(self):

    s3db = current.s3db
    assertEqual = self.assertEqual
    assertTrue = self.assertTrue
    resource = s3db.resource('project_project')
    q = ((FS('virtualfield') == 'test') & (resource.table.name == 'test'))
    project_project = resource.table
    (joins, distinct) = q._joins(resource)
    assertEqual(joins, {})
    (joins, distinct) = q._joins(resource, left=True)
    assertEqual(joins, {})
    (qq, qf) = q.split(resource)
    expected = (project_project.name == 'test')
    assertEqual(str(qq), str(expected))
    assertTrue(isinstance(qf, S3ResourceQuery))
    resource.add_filter(q)
    query = resource.get_query()
    expected = (((project_project.deleted != True) & (project_project.id > 0)) & (project_project.name == 'test'))
    assertEqual(str(query), str(expected))
