diff --git a/pontos/version/schemes/_pep440.py b/pontos/version/schemes/_pep440.py index 415824fb1..5b41fc65f 100644 --- a/pontos/version/schemes/_pep440.py +++ b/pontos/version/schemes/_pep440.py @@ -149,6 +149,9 @@ def from_version(cls, version: "Version") -> "PEP440Version": return cls.from_string(str(version)) def __eq__(self, other: Any) -> bool: + if isinstance(other, str): + # allow to compare against "current" for now + return False if not isinstance(other, Version): raise ValueError(f"Can't compare {type(self)} with {type(other)}") if not isinstance(other, type(self)): @@ -156,6 +159,9 @@ def __eq__(self, other: Any) -> bool: return self._version == other._version def __ne__(self, other: Any) -> bool: + if isinstance(other, str): + # allow to compare against "current" for now + return True if not isinstance(other, Version): raise ValueError(f"Can't compare {type(self)} with {type(other)}") if not isinstance(other, type(self)): diff --git a/pontos/version/schemes/_semantic.py b/pontos/version/schemes/_semantic.py index f6c48e4bf..e8dbaa066 100644 --- a/pontos/version/schemes/_semantic.py +++ b/pontos/version/schemes/_semantic.py @@ -116,6 +116,9 @@ def patch(self) -> int: return self._version_info.patch def __eq__(self, other: Any) -> bool: + if isinstance(other, str): + # allow to compare against "current" for now + return False if not isinstance(other, Version): raise ValueError(f"Can't compare {type(self)} with {type(other)}") if not isinstance(other, type(self)): @@ -124,6 +127,9 @@ def __eq__(self, other: Any) -> bool: return self._version_info == other._version_info def __ne__(self, other: Any) -> bool: + if isinstance(other, str): + # allow to compare against "current" for now + return True if not isinstance(other, Version): raise ValueError(f"Can't compare {type(self)} with {type(other)}") if not isinstance(other, type(self)):