summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcheck_checkers.py31
-rw-r--r--puzzles/50_typevar_constrained.py2
2 files changed, 24 insertions, 9 deletions
diff --git a/check_checkers.py b/check_checkers.py
index e8b1b2f..aee3f49 100755
--- a/check_checkers.py
+++ b/check_checkers.py
@@ -192,7 +192,11 @@ def run(
out.write('</a>')
if checker.extra_flags:
out.write(' with ')
- out.write(', '.join(f'<code>{html.escape(flag)}</code>' for flag in checker.extra_flags))
+ out.write(
+ ', '.join(
+ f'<code>{html.escape(flag)}</code>' for flag in checker.extra_flags
+ )
+ )
out.write('<br>({})'.format(html.escape(checker.version())))
out.write('</tr>')
@@ -216,10 +220,23 @@ def run(
error_ok = '# error' in code or '# maybe error' in code
no_error_ok = '# error' not in code
- for checker in checkers:
- errors = checker_results[checker.__class__.__name__]
+ results = [
+ (checker.__class__.__name__, checker_results[checker.__class__.__name__])
+ for checker in checkers
+ ]
+
+ while results:
+ class_name, errors = results.pop(0)
expected = (errors and error_ok) or (not errors and no_error_ok)
- out.write('<td class="{}">'.format('ok' if expected else 'unexpected'))
+ colspan = 1
+ if errors and results and results[0][1] == errors:
+ results.pop(0)
+ colspan = 2
+ out.write(
+ '<td class="{}" colspan={}>'.format(
+ 'ok' if expected else 'unexpected', colspan
+ )
+ )
if errors:
out.write('<ul>')
for filename, line, message in errors:
@@ -231,10 +248,8 @@ def run(
out.write('<center>no errors found')
if not expected:
checker_issues = issues.get(
- checker.__class__.__name__.lower(),
- issues.get(
- checker.__class__.__name__.lower().replace('strict', ''), {}
- ),
+ class_name.lower(),
+ issues.get(class_name.lower().replace('strict', ''), {}),
)
issue = checker_issues.get(
os.path.splitext(os.path.basename(puzzle))[0].split(
diff --git a/puzzles/50_typevar_constrained.py b/puzzles/50_typevar_constrained.py
index 50ce10a..4cff369 100644
--- a/puzzles/50_typevar_constrained.py
+++ b/puzzles/50_typevar_constrained.py
@@ -5,5 +5,5 @@ V = TypeVar("V", str, bytes)
def check_v(x: Union[V, list[V]]) -> V:
raise NotImplementedError()
-def foo(a: list[Any]):
+def foo(a: list[Any]) -> None:
check_v(a)