Fix pytest not respecting the singleton pattern

This is only a temporary fix!

See issue: https://github.com/webartifex/lalib/issues/1
This commit is contained in:
Alexander Hess 2024-09-27 16:16:01 +02:00
parent 3d9f990c68
commit 08067b3d6e
Signed by: alexander
GPG key ID: 344EA5AB10D868E0

View file

@ -316,7 +316,13 @@ class GF2Element(metaclass=GF2Meta):
except (TypeError, ValueError):
return False
else:
return self is other # `one` and `zero` are singletons
# TODO(webartifex): investigate the below issue
# https://github.com/webartifex/lalib/issues/1
# `one` and `zero` are singletons
# => yet, the following does not work with `pytest`
# in Python 3.9 & 3.10: `return self is other`
# => for now, use the following fix:
return int(self) == int(other)
def __lt__(self, other: object) -> bool:
"""Comparison: `self < other`.