'Resolution of a selector for a field in a link-table component'

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

    assertEqual = self.assertEqual
    assertNotEqual = self.assertNotEqual
    assertTrue = self.assertTrue
    s3db = current.s3db
    project_project = s3db.project_project
    project_task_project = s3db.project_task_project
    project_task = s3db.project_task
    resource = s3db.resource('project_project')
    selector = 'task.description'
    f = S3ResourceField(resource, selector)
    assertNotEqual(f, None)
    assertEqual(f.selector, selector)
    assertEqual(str(f.field), 'project_task.description')
    assertEqual(str(f.tname), 'project_task')
    assertEqual(str(f.fname), 'description')
    assertEqual(str(f.colname), 'project_task.description')
    assertTrue(isinstance(f.left['project_task'], list))
    assertEqual(len(f.left['project_task']), 2)
    expected_l = project_task_project.on(((project_task_project.project_id == project_project.id) & (project_task_project.deleted != True)))
    expected_r = project_task.on((project_task_project.task_id == project_task.id))
    assertEqual(str(f.left['project_task'][0]), str(expected_l))
    assertEqual(str(f.left['project_task'][1]), str(expected_r))
    expected = (((project_task_project.project_id == project_project.id) & (project_task_project.deleted != True)) & (project_task_project.task_id == project_task.id))
    assertEqual(str(f.join['project_task']), str(expected))
    assertTrue(f.distinct)
