Skip to content

Commit

Permalink
Add eq method (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
VascoSch92 authored Dec 31, 2023
2 parents a909e5a + d89493d commit 80bb3fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ The version is represented by three digits: a.b.c.

ENHANCEMENT:
- sequentium.tests.sequence_tests_suite.py: self.ground_truth_length is removed as we can perform same tests without it.
- sequentium.core.core.py: added __str__ method in core class
- sequentium.core.core.py: added __str__ method in Sequence class
- sequentium.ruff.toml: added rule "ANN"
- sequentium.core.core.py: added __eq__ method in Sequence clas

---
## [0.0.0] - 2023-12-28
Expand Down
7 changes: 7 additions & 0 deletions sequence/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ class Sequence(ABC):
def __contains__(self, item: Any) -> bool:
raise NotImplementedError

def __eq__(self, other: Any) -> bool:
"""
The method checks if the representation of the sequence is the same.
It doesn't check that two sequences are equal, but that two sequences are different instance of the same class.
"""
return other.__str__() == self.__str__() and other.__dict__ == self.__dict__

def __str__(self) -> str:
return self.sequence_name

Expand Down

0 comments on commit 80bb3fa

Please sign in to comment.