build.{dsl,res}: allow removing attributes from subsignals.
This is useful when most attributes in a large composite resource are the same, but a few signals are different, and also when building abstractions around resources. Fixes #128.
This commit is contained in:
parent
f0c1c2cfeb
commit
0b844da4cf
3 changed files with 17 additions and 6 deletions
|
|
@ -113,9 +113,14 @@ class AttrsTestCase(FHDLTestCase):
|
|||
self.assertEqual(a["IO_STANDARD"], "LVCMOS33")
|
||||
self.assertEqual(repr(a), "(attrs IO_STANDARD=LVCMOS33 PULLUP=1)")
|
||||
|
||||
def test_remove(self):
|
||||
a = Attrs(FOO=None)
|
||||
self.assertEqual(a["FOO"], None)
|
||||
self.assertEqual(repr(a), "(attrs !FOO)")
|
||||
|
||||
def test_wrong_value(self):
|
||||
with self.assertRaises(TypeError,
|
||||
msg="Attribute value must be a string, not 1"):
|
||||
msg="Attribute value must be None or str, not 1"):
|
||||
a = Attrs(FOO=1)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue