parent
0fb2b4cd39
commit
de7c9acb19
|
@ -15,10 +15,10 @@ __all__ = ["flatten", "union" , "log2_int", "bits_for", "memoize", "final", "dep
|
|||
|
||||
def flatten(i):
|
||||
for e in i:
|
||||
if isinstance(e, Iterable):
|
||||
yield from flatten(e)
|
||||
else:
|
||||
if isinstance(e, str) or not isinstance(e, Iterable):
|
||||
yield e
|
||||
else:
|
||||
yield from flatten(e)
|
||||
|
||||
|
||||
def union(i, start=None):
|
||||
|
|
|
@ -740,6 +740,11 @@ class CatTestCase(FHDLTestCase):
|
|||
def test_cast(self):
|
||||
c = Cat(1, 0)
|
||||
self.assertEqual(repr(c), "(cat (const 1'd1) (const 1'd0))")
|
||||
|
||||
def test_str_wrong(self):
|
||||
with self.assertRaisesRegex(TypeError,
|
||||
r"^Object 'foo' cannot be converted to an Amaranth value$"):
|
||||
Cat("foo")
|
||||
|
||||
|
||||
class ReplTestCase(FHDLTestCase):
|
||||
|
|
Loading…
Reference in a new issue