MCPcopy Index your code
hub / github.com/RustPython/RustPython / format_test_todo_list

Function format_test_todo_list

scripts/update_lib/cmd_todo.py:406–447  ·  view source on GitHub ↗

Format test todo list for display. Groups tests by lib_name. If multiple tests share the same lib_name, the first test is shown as the primary and others are indented below it.

(
    todo_list: list[dict],
    limit: int | None = None,
)

Source from the content-addressed store, hash-verified

404
405
406def format_test_todo_list(
407 todo_list: list[dict],
408 limit: int | None = None,
409) -> list[str]:
410 """Format test todo list for display.
411
412 Groups tests by lib_name. If multiple tests share the same lib_name,
413 the first test is shown as the primary and others are indented below it.
414 """
415 lines = []
416
417 if limit:
418 todo_list = todo_list[:limit]
419
420 # Group by lib_name
421 grouped: dict[str, list[dict]] = {}
422 for item in todo_list:
423 lib_name = item.get("lib_name", item["name"])
424 if lib_name not in grouped:
425 grouped[lib_name] = []
426 grouped[lib_name].append(item)
427
428 # Sort each group by test_order (from DEPENDENCIES)
429 for tests in grouped.values():
430 tests.sort(key=lambda x: x.get("test_order", 0))
431
432 for lib_name, tests in grouped.items():
433 # First test is the primary
434 primary = tests[0]
435 done_mark = "[x]" if primary["up_to_date"] else "[ ]"
436 suffix = _format_test_suffix(primary)
437 meta = _format_meta_suffix(primary)
438 lines.append(f"- {done_mark} `{primary['name']}`{suffix}{meta}")
439
440 # Rest are indented
441 for item in tests[1:]:
442 done_mark = "[x]" if item["up_to_date"] else "[ ]"
443 suffix = _format_test_suffix(item)
444 meta = _format_meta_suffix(item)
445 lines.append(f" - {done_mark} `{item['name']}`{suffix}{meta}")
446
447 return lines
448
449
450def format_todo_list(

Callers 1

format_all_todoFunction · 0.85

Calls 7

_format_test_suffixFunction · 0.85
_format_meta_suffixFunction · 0.85
getMethod · 0.45
appendMethod · 0.45
valuesMethod · 0.45
sortMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected