Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion capycli/common/comparable_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def __eq__(self, other: ComparableVersion | object) -> bool:
def __ne__(self, other: ComparableVersion | object) -> bool:
"""describes not equal to operator(!=)"""
if not isinstance(other, self.__class__):
return False
return True

try:
return self.compare(other) != 0
Expand Down
6 changes: 6 additions & 0 deletions tests/test_comparable_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,9 @@ def test_fill_version(self) -> None:
version2 = ComparableVersion("3.28")
self.assertEqual(version1, version2, "The version should be equal")
self.assertEqual(version2, version1, "The version should be equal")

def test_ne_with_non_comparable_version(self) -> None:
"""__ne__ should return True when comparing to a non-ComparableVersion object"""
self.assertTrue(ComparableVersion("1.0") != "1.0")
self.assertTrue(ComparableVersion("1.0") != 42)
self.assertIsNotNone(ComparableVersion("1.0"))
Loading