================
@@ -308,10 +310,10 @@ def test_element_type(self):
def test_invalid_element_type(self):
"""Ensure Type.element_type raises if type doesn't have elements."""
tu = get_tu("int i;")
- i = get_cursor(tu, "i")
- self.assertIsNotNone(i)
- with self.assertRaises(Exception):
- i.element_type
+ ty = get_cursor(tu, "i").type
+ with self.assertRaises(Exception) as ctx:
+ ty.element_type
+ self.assertEqual(str(ctx.exception), "Element type not available on
this type.")
----------------
DeinAlptraum wrote:
This test didn't make any sense previously: `i` was of type `Cursor`, so the
test raised an `AttributeError` exception due to missing `element_type`
attribute.
https://github.com/llvm/llvm-project/pull/109846
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits