Skip to content

Commit 4b1d2bb

Browse files
committed
Customize error message
1 parent 7439bc9 commit 4b1d2bb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

clang/bindings/python/tests/cindex/test_enums.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ def test_all_variants(self):
7373

7474
for enum in self.enums:
7575
with self.subTest(enum):
76+
# This ensures only the custom assert message below is printed
77+
self.longMessage = False
78+
7679
python_kinds = set([kind.value for kind in enum])
7780
num_to_c_kind = enum_variant_map[enum]
7881
c_kinds = set(num_to_c_kind.keys())
@@ -84,6 +87,7 @@ def test_all_variants(self):
8487
self.assertEqual(
8588
missing_names,
8689
set(),
90+
f"{missing_names} variants are missing. "
8791
f"Please ensure these are defined in {enum} in cindex.py.",
8892
)
8993
# Defined in cindex.py but not in Index.h
@@ -94,5 +98,6 @@ def test_all_variants(self):
9498
self.assertEqual(
9599
missing_names,
96100
set(),
101+
f"{missing_names} variants only exist in the Python bindings. "
97102
f"Please ensure that all {enum} kinds defined in cindex.py have an equivalent in Index.h",
98103
)

0 commit comments

Comments
 (0)