We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
xxx in Value
1 parent 86d14f5 commit bf8faeaCopy full SHA for bf8faea
amaranth/hdl/ast.py
@@ -377,6 +377,9 @@ def __getitem__(self, key):
377
else:
378
raise TypeError(f"Cannot index value with {key!r}")
379
380
+ def __contains__(self, other):
381
+ raise TypeError("Cannot use 'in' with an Amaranth value")
382
+
383
def as_unsigned(self):
384
"""Conversion to unsigned.
385
tests/test_hdl_ast.py
@@ -750,6 +750,11 @@ def test_abs(self):
750
""")
751
self.assertEqual(abs(s).shape(), unsigned(4))
752
753
+ def test_contains(self):
754
+ with self.assertRaisesRegex(TypeError,
755
+ r"^Cannot use 'in' with an Amaranth value$"):
756
+ 1 in Signal(3)
757
758
759
class SliceTestCase(FHDLTestCase):
760
def test_shape(self):
0 commit comments