def test_copy_evidence(self): entity = Reaction() target = Gene() eco = "ECO:000000" assertion = "Presence" comment = "test comment" reference = Reference() evidence = Evidence(entity=entity, eco=eco, assertion=assertion, comment=comment, target=target) evidence.add_reference(reference) # Create copy copy = evidence.copy() # Check the correctness of the copy assert evidence.entity is copy.entity assert evidence.target is copy.target assert evidence.eco == copy.eco assert evidence.assertion == copy.assertion assert evidence.comment == copy.comment assert evidence.references == copy.references assert evidence.references is not copy.references # Check that the copy is not linked assert copy not in entity.evidences assert copy not in reference.linked_items assert copy not in target.evidences
def test_equality(self): entity = Reaction() target = Gene() eco = "ECO:000000" assertion = "Presence" comment = "test comment" reference = Reference() evidence = Evidence(entity=entity, eco=eco, assertion=assertion, comment=comment, target=target) evidence.add_reference(reference) assert evidence.copy() == evidence
def test_inequality(self, attribute, new_value): entity = Reaction() target = Gene() eco = "ECO:000000" assertion = "Presence" comment = "test comment" reference = Reference() evidence = Evidence(entity=entity, eco=eco, assertion=assertion, comment=comment, target=target) evidence.add_reference(reference) new_copy = evidence.copy() setattr(new_copy, attribute, new_value) assert new_copy != evidence assert not new_copy == evidence
def test_inequality_reference(self): entity = Reaction() target = Gene() eco = "ECO:000000" assertion = "Presence" comment = "test comment" reference = Reference() evidence = Evidence(entity=entity, eco=eco, assertion=assertion, comment=comment, target=target) evidence.add_reference(reference) new_copy = evidence.copy() new_copy.remove_all_references() assert new_copy != evidence assert not new_copy == evidence