X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=nmigen%2Ftest%2Ftest_hdl_ast.py;h=691408a0363e9a4d3bdea0f659b0888863420cec;hb=659b0e8189fdf99be678d5713259ba59726d991b;hp=b724ad6fef3f1ed39ddf6a6fa8b924372eb6658d;hpb=fd5ee548b6e333c92877440524c116e09bdd7c73;p=nmigen.git diff --git a/nmigen/test/test_hdl_ast.py b/nmigen/test/test_hdl_ast.py index b724ad6..691408a 100644 --- a/nmigen/test/test_hdl_ast.py +++ b/nmigen/test/test_hdl_ast.py @@ -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)")