Repository: RustPython/RustPython
File: scripts/update_lib/show_todo.py (Python)

Code before:
        - If corresponding lib is NOT up-to-date: score = 1 (wait for lib)
        - If no corresponding lib: score = -1 (independent)

    Returns:
        List of dicts with test info, sorted by priority
    """
    all_tests = get_all_tests(cpython_prefix)
    test_to_lib, lib_test_order = _build_test_to_lib_map(cpython_prefix)

    result = []
    for test_name in all_tests:
        up_to_date = is_test_up_to_date(test_name, cpython_prefix, lib_prefix)

        if up_to_date and not include_done:
            continue

        tracked = is_test_tracked(test_name, cpython_prefix, lib_prefix)

        # Check DEPENDENCIES mapping first, then fall back to simple extraction
        if test_name in test_to_lib:
            lib_name = test_to_lib[test_name]
            # Get order from DEPENDENCIES
            test_order = lib_test_order[lib_name].index(test_name)
        else:
            # Extract lib name from test name (test_foo -> foo)
            lib_name = test_name[5:] if test_name.startswith("test_") else test_name
            test_order = 0  # Default order for tests not in DEPENDENCIES

        # Check if corresponding lib is up-to-date
        # Scoring: 0 = lib ready (highest priority), 1 = no lib, 2 = lib pending
        if lib_status and lib_name in lib_status:
            lib_up_to_date = lib_status[lib_name]
            if lib_up_to_date:
                score = 0  # Lib is ready, can update test
            else:
                score = 2  # Wait for lib first
        else:
            score = 1  # No corresponding lib (independent test)

        todo_count = count_test_todos(test_name, lib_prefix) if tracked else 0

        result.append(
            {
                "name": test_name,
                "lib_name": lib_name,
                "score": score,
                "up_to_date": up_to_date,
                "tracked": tracked,
                "todo_count": todo_count,
                "test_order": test_order,
            }

Review comment (suggestion):
```suggestion
            lib_name = test_name.removeprefix("test_")
```

Code after:
        - If no corresponding lib: score = 1 (independent)
        - If corresponding lib is NOT up-to-date: score = 2 (wait for lib)

    Returns:
        List of dicts with test info, sorted by priority
    """
    all_tests = get_all_tests(cpython_prefix)
    test_to_lib, lib_test_order = _build_test_to_lib_map(cpython_prefix)

    result = []
    for test_name in all_tests:
        up_to_date = is_test_up_to_date(test_name, cpython_prefix, lib_prefix)

        if up_to_date and not include_done:
            continue

        tracked = is_test_tracked(test_name, cpython_prefix, lib_prefix)

        # Check DEPENDENCIES mapping first, then fall back to simple extraction
        if test_name in test_to_lib:
            lib_name = test_to_lib[test_name]
            # Get order from DEPENDENCIES
            test_order = lib_test_order[lib_name].index(test_name)
        else:
            # Extract lib name from test name (test_foo -> foo)
            lib_name = test_name.removeprefix("test_")
            test_order = 0  # Default order for tests not in DEPENDENCIES

        # Check if corresponding lib is up-to-date
        # Scoring: 0 = lib ready (highest priority), 1 = no lib, 2 = lib pending
        if lib_status and lib_name in lib_status:
            lib_up_to_date = lib_status[lib_name]
            if lib_up_to_date:
                score = 0  # Lib is ready, can update test
            else:
                score = 2  # Wait for lib first
        else:
            score = 1  # No corresponding lib (independent test)

        todo_count = count_test_todos(test_name, lib_prefix) if tracked else 0

        result.append(
            {
                "name": test_name,
                "lib_name": lib_name,
                "score": score,
                "up_to_date": up_to_date,
                "tracked": tracked,
                "todo_count": todo_count,
                "test_order": test_order,
            }