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:
parent
3d9f990c68
commit
08067b3d6e
1 changed files with 7 additions and 1 deletions
|
@ -316,7 +316,13 @@ class GF2Element(metaclass=GF2Meta):
|
||||||
except (TypeError, ValueError):
|
except (TypeError, ValueError):
|
||||||
return False
|
return False
|
||||||
else:
|
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:
|
def __lt__(self, other: object) -> bool:
|
||||||
"""Comparison: `self < other`.
|
"""Comparison: `self < other`.
|
||||||
|
|
Loading…
Reference in a new issue