def testMultipleNameMatchesWithParentItemMismatch(self):

        db = current.db
        s3db = current.s3db

        assertEqual = self.assertEqual
        assertTrue = self.assertTrue

        otable = s3db.org_organisation
        btable = s3db.org_organisation_branch

        # Verify that there are two DeDupBranch2 (in pristine state)
        query = (otable.name == "DeDupBranch2")
        rows = db(query).select(otable.id, otable.comments)
        assertEqual(len(rows), 2)
        for row in rows:
            assertEqual(row.comments, None)
        branch_ids = [row.id for row in rows]

        # Verify the parents for DeDupBranch2
        query = (btable.branch_id.belongs(branch_ids)) & \
                (btable.deleted != True) & \
                (otable.id == btable.organisation_id)
        rows = db(query).select(otable.uuid)
        assertEqual(len(rows), 2)
        for row in rows:
            assertTrue(row.uuid in ("DEDUPORGA", "DEDUPORGB"))

        # Test with different parent
        xmlstr = """
<s3xml>
    <resource name="org_organisation" tuid="PARENT">
        <data field="name">DeDupOrgC</data>
    </resource>
    <resource name="org_organisation">
        <data field="name">DeDupBranch2</data>
        <data field="comments">created</data>
        <resource name="org_organisation_branch" alias="parent">
            <reference field="organisation_id" resource="org_organisation" tuid="PARENT"/>
        </resource>
    </resource>
</s3xml>"""

        xmltree = etree.ElementTree(etree.fromstring(xmlstr))

        resource = s3db.resource("org_organisation")
        resource.import_xml(xmltree, ignore_errors=True)

        # Verify that there are now three DeDupBranch2
        query = (otable.name == "DeDupBranch2")
        rows = db(query).select(otable.id, otable.uuid, otable.comments)
        assertEqual(len(rows), 3)
        for row in rows:
            if row.uuid in ("DEDUPBRANCHA2", "DEDUPBRANCHB2"):
                # DEDUPBRANCHA2 and DEDUPBRANCHB2 have not changed
                assertEqual(row.comments, None)
            else:
                # New branch has comments
                assertEqual(row.comments, "created")
        branch_ids = [row.id for row in rows]

        # Verify the parents for DeDupBranch2
        query = (btable.branch_id.belongs(branch_ids)) & \
                (btable.deleted != True) & \
                (otable.id == btable.organisation_id)
        rows = db(query).select(otable.uuid)
        assertEqual(len(rows), 3)
        for row in rows:
            assertTrue(row.uuid in ("DEDUPORGA", "DEDUPORGB", "DEDUPORGC"))

    # -------------------------------------------------------------------------
Implement L{IReactorFDSet.removeAll}.
dataset/ETHPy150Open sahana/eden/modules/unit_tests/s3db/org.py/OrgDeduplicationTests.testMultipleNameMatchesWithParentItemMismatch--crossover with--dataset/ETHPy150Open twisted/twisted/twisted/internet/kqreactor.py/KQueueReactor.removeAll