def testSelector(self):

        fields = "name"
        s3db = current.s3db

        widget = S3FilterWidget()

        resource = s3db.resource("org_organisation")
        label, selector = widget._selector(resource, fields)
        self.assertEqual(selector, "~.name")

        widget.alias = "organisation"
        label, selector = widget._selector(resource, fields)
        self.assertEqual(selector, "organisation.name")
        widget.alias = None

        fields = "nonexistent_component.name"

        resource = s3db.resource("org_organisation")
        label, selector = widget._selector(resource, fields)
        self.assertEqual(selector, None)

        fields = ["name", "organisation_id$name"]

        resource = s3db.resource("org_office")
        label, selector = widget._selector(resource, fields)
        self.assertEqual(selector, "~.name|~.organisation_id$name")

        fields = []

        resource = s3db.resource("org_organisation")
        label, selector = widget._selector(resource, fields)
        self.assertEqual(selector, None)
Test construction of the URL query selector for a filter widget
dataset/ETHPy150Open sahana/eden/modules/unit_tests/s3/s3filter.py/S3FilterWidgetTests.testSelector