def testExportOptionsXMLHierarchy(self):
        """ Test Export Options (all options, XML+hierarchy) """

        assertEqual = self.assertEqual
        assertTrue = self.assertTrue

        # Configure parent-field
        db = current.db
        table = db.fotest_lookup_table
        represent = S3Represent(lookup="fotest_lookup_table")
        table.parent.requires = IS_EMPTY_OR(
                                    IS_ONE_OF(db,
                                                "fotest_lookup_table.id",
                                                represent,
                                                ))
        table.parent.requires = represent

        # Configure hierarchy
        s3db = current.s3db
        s3db.configure("fotest_lookup_table", hierarchy="parent")
        S3Hierarchy.dirty("fotest_lookup_table")

        # Insert a child node
        options = dict(self.records)
        child_node = {"name": "option3",
                      "uuid": "OPTION3",
                      "parent": options.keys()[0],
                      }
        child_id = table.insert(**child_node)
        options[child_id] = child_node

        # Request options
        resource = s3db.resource("fotest_table")
        result = resource.export_options(fields=["lookup"], hierarchy=True)
        fo = etree.XML(result)

        # Inspect result
        xml = current.xml
        ATTRIBUTE = xml.ATTRIBUTE
        VALUE = ATTRIBUTE.value
        PARENT = ATTRIBUTE.parent
        UID = xml.UID

        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, None)
                continue
            else:
                value = int(value)

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

            if options[value] in "parent" and options[value]["parent"]:
                assertTrue(PARENT in attr)
                assertEqual(attr[PARENT], str(options[value]["parent"]))

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

    # -------------------------------------------------------------------------
dataset/ETHPy150Open sahana/eden/modules/unit_tests/s3/s3xml.py/GetFieldOptionsTests.testExportOptionsXMLHierarchy/swapped operands of `in`