From 6d33a95fed9ca9d288a85b43dfb0e1a686a9ea5c Mon Sep 17 00:00:00 2001 From: vasco Date: Sun, 31 Dec 2023 15:23:07 +0100 Subject: [PATCH 1/2] update --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d36dd1..85a260f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 From d89493dccb7d41d607ee92b79472eb17ec476e5d Mon Sep 17 00:00:00 2001 From: vasco Date: Sun, 31 Dec 2023 15:23:16 +0100 Subject: [PATCH 2/2] add __eq__ method --- sequence/core/core.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sequence/core/core.py b/sequence/core/core.py index aa44615..d8a415f 100644 --- a/sequence/core/core.py +++ b/sequence/core/core.py @@ -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