hdl.ast: don't inherit Shape from NamedTuple.

Fixes #421.
This commit is contained in:
awygle 2020-07-06 22:17:03 -07:00 committed by GitHub
parent cee43f0de1
commit 659b0e8189
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 10 deletions

View file

@ -39,6 +39,16 @@ class ShapeTestCase(FHDLTestCase):
msg="Width must be a non-negative integer, not -1"):
Shape(-1)
def test_compare_wrong(self):
with self.assertRaises(TypeError,
msg="Shapes may be compared with other Shapes and (int, bool) tuples, not 'hi'"):
Shape(1, True) == 'hi'
def test_compare_tuple_wrong(self):
with self.assertRaises(TypeError,
msg="Shapes may be compared with other Shapes and (int, bool) tuples, not (2, 3)"):
Shape(1, True) == (2, 3)
def test_repr(self):
self.assertEqual(repr(Shape()), "unsigned(1)")
self.assertEqual(repr(Shape(2, True)), "signed(2)")