From 08067b3d6eeb623f5174abc2d2932670e11c27d3 Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Fri, 27 Sep 2024 16:16:01 +0200 Subject: [PATCH] Fix pytest not respecting the singleton pattern This is only a temporary fix! See issue: https://github.com/webartifex/lalib/issues/1 --- src/lalib/elements/galois.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lalib/elements/galois.py b/src/lalib/elements/galois.py index 329714c..03a9ea2 100644 --- a/src/lalib/elements/galois.py +++ b/src/lalib/elements/galois.py @@ -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`.