Skip to content

Commit d3d0822

Browse files
committed
Also check case description length in sanity checks.
The reason we do this is both to force conciseness but also because runners of the suite likely turn one or more of the combination of case description and test description into an identifier within the implementer's test framework. If descriptions are really long, it makes things like copy pasting test names more annoying or difficult. 150 is quite long -- we use 70 for test descriptions, so in total this means potentially 220 characters for the combined length. I'd like to bring this down a bit but this is the number that passes all existing descriptions at least.
1 parent 5e7804c commit d3d0822

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

bin/jsonschema_suite

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,19 @@ class SanityTests(unittest.TestCase):
116116
except ValueError as error:
117117
self.fail(f"{path} contains invalid JSON ({error})")
118118

119-
def test_all_descriptions_have_reasonable_length(self):
119+
def test_all_case_descriptions_have_reasonable_length(self):
120+
"""
121+
All cases have reasonably long descriptions.
122+
"""
123+
for case in cases(self.test_files):
124+
with self.subTest(description=case["description"]):
125+
self.assertLess(
126+
len(case["description"]),
127+
150,
128+
"Description is too long (keep it to less than 150 chars)."
129+
)
130+
131+
def test_all_test_descriptions_have_reasonable_length(self):
120132
"""
121133
All tests have reasonably long descriptions.
122134
"""

0 commit comments

Comments
 (0)