def startElement(self, name, attrs): if name == "definitionArc": relationship = taxonomy.Relationship() for item in attrs.items(): if item[0] == "xlink:arcrole": relationship.role = taxonomy.RelationshipRole( item[1].split("/")[-1]) if item[0] == "xlink:from": relationship.from_ = item[1].replace("_", ":", 1) if item[0] == "xlink:to": relationship.to = item[1].replace("_", ":", 1) if item[0] == "order": relationship.order = item[1] self._relationships.append(relationship)
def test_relationship(self): self.assertIsInstance(taxonomy.Relationship(), taxonomy.Relationship)