def testShowUIDs(self):
        """ Test options lookup with foreign key constraint including UIDs """

        assertEqual = self.assertEqual
        assertTrue = self.assertTrue

        table = current.db.fotest_table

        xml = current.xml
        fo = xml.get_field_options(table, "lookup", show_uids=True)

        assertTrue(isinstance(fo, etree._Element))
        assertEqual(fo.tag, "select")

        ATTRIBUTE = xml.ATTRIBUTE
        VALUE = ATTRIBUTE.value
        UID = xml.UID
        options = self.records

        has_empty = False
        self.assertEqual(len(fo), len(options) + 1)
        for opt in fo:
            assertEqual(opt.tag, "option")

            attr = opt.attrib
            assertTrue(VALUE in attr)

            value = attr[VALUE]
            if value == "":
                has_empty = True
                self.assertFalse(UID in attr)
                assertEqual(opt.text, "")
                continue
            else:
                value = int(value)

            assertTrue(UID in attr)
            assertEqual(attr[UID], options[value]["uuid"])
            assertTrue(value in options)
            assertEqual(opt.text, options[value]["name"])

        assertTrue(has_empty, msg="Empty-option missing")

    # -------------------------------------------------------------------------
dataset/ETHPy150Open sahana/eden/modules/unit_tests/s3/s3xml.py/GetFieldOptionsTests.testShowUIDs/original