Skip to content

fix: add actionable assertion messages to itertools checks - #146

Open
kamalesh404 wants to merge 6 commits into
abhiksark:mainfrom
kamalesh404:fix/assertion-messages
Open

kamalesh404 wants to merge 6 commits into
abhiksark:mainfrom
kamalesh404:fix/assertion-messages

Conversation

@kamalesh404

@kamalesh404 kamalesh404 commented Sep 14, 2026

Copy link
Copy Markdown

Fixes #100

Adds descriptive error messages to 7 bare assertions across 6 itertools check files. When a student's code fails, they now see what was expected vs what they produced, instead of a generic \AssertionError.

Changes:

  • \itertools3.py: Added message for coordinates assertion
  • \itertools4.py: Added message for grouped dictionary assertion
  • \itertools5.py: Added message for running totals assertion
  • \itertools6.py: Added message for repeated values assertion
  • \itertools7.py: Added message for pairs assertion
  • \itertools8.py: Added messages for flattened list and adjacent pairs assertions

All assertions now include f-string messages showing expected vs actual values.

Summary by CodeRabbit

  • Tests
    • Improved assertion failure messages across itertools checks.
    • Failed checks now show the expected and actual values, making test failures easier to diagnose.

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 0be32878-59a3-4dfd-bf8b-97d7bab02cb0

📥 Commits

Reviewing files that changed from the base of the PR and between b4d40bf and defb4a4.

📒 Files selected for processing (6)
  • checks/itertools/itertools3.py
  • checks/itertools/itertools4.py
  • checks/itertools/itertools5.py
  • checks/itertools/itertools6.py
  • checks/itertools/itertools7.py
  • checks/itertools/itertools8.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (3)
Maintain Python 3.9 compatibility.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • checks/itertools/itertools7.py
  • checks/itertools/itertools8.py
  • checks/itertools/itertools4.py
  • checks/itertools/itertools3.py
  • checks/itertools/itertools5.py
  • checks/itertools/itertools6.py
Preserve learner-edited exercises during workspace updates.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • checks/itertools/itertools7.py
  • checks/itertools/itertools8.py
  • checks/itertools/itertools4.py
  • checks/itertools/itertools3.py
  • checks/itertools/itertools5.py
  • checks/itertools/itertools6.py
Checks must use bare assertions with actionable, beginner-facing messages.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • checks/itertools/itertools7.py
  • checks/itertools/itertools8.py
  • checks/itertools/itertools4.py
  • checks/itertools/itertools3.py
  • checks/itertools/itertools5.py
  • checks/itertools/itertools6.py
🪛 Ruff (0.16.4)
checks/itertools/itertools7.py

[error] 1-1: Undefined name pairs

(F821)

checks/itertools/itertools8.py

[error] 1-1: Undefined name flattened

(F821)


[error] 2-2: Undefined name adjacent_pairs

(F821)

checks/itertools/itertools4.py

[error] 1-1: Undefined name grouped

(F821)

checks/itertools/itertools3.py

[error] 1-1: Undefined name coordinates

(F821)

checks/itertools/itertools5.py

[error] 1-1: Undefined name running_totals

(F821)

checks/itertools/itertools6.py

[error] 1-1: Undefined name repeated

(F821)

🔇 Additional comments (6)
checks/itertools/itertools3.py (1)

1-1: LGTM!

checks/itertools/itertools4.py (1)

1-1: LGTM!

checks/itertools/itertools5.py (1)

1-1: LGTM!

checks/itertools/itertools6.py (1)

1-1: LGTM!

checks/itertools/itertools7.py (1)

1-1: LGTM!

checks/itertools/itertools8.py (1)

1-2: LGTM!


📝 Walkthrough

Walkthrough

The change adds failure messages to seven assertions in six itertools checks. Messages show expected values and available actual values. Assertion predicates remain unchanged.

Changes

Itinerables assertion messages

Layer / File(s) Summary
Add failure diagnostics
checks/itertools/itertools3.py, checks/itertools/itertools4.py, checks/itertools/itertools5.py, checks/itertools/itertools6.py, checks/itertools/itertools7.py, checks/itertools/itertools8.py
Seven assertions now include descriptive messages with expected values and actual results.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Low

Poem

A rabbit checks each path,
Expected values hop in line,
Actuals leave a trail,
Bare errors now speak clearly,
Seven carrots of insight.

Merge Risk: ⚪ Minimal · up to defb4

The six checks only gain clearer failure messages; their validation behavior and success paths remain unchanged, so there is no merge-blocking risk.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the changes and scope, but it does not follow the required template. It omits the Tests, Screenshots, and Checklist sections. Add the required Tests, Screenshots, and Checklist sections. Report the test command and result, state whether screenshots are applicable, and complete each checklist item.
Linked Issues check ❓ Inconclusive For [#100], the summary supports seven non-empty f-string messages in the six specified files. It also reports expected and actual values and one-line changes per assertion. The available evidence doe… Provide reviewable verification evidence for the required test commands, the AST audit showing zero bare assertions in the six files, and Python 3.9 compatibility. Provide a complete whole-PR diff or equivalent evidence if the verification …
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding actionable assertion messages to the itertools checks.
Out of Scope Changes check ✅ Passed The summary reports changes only in checks/itertools/itertools3.py through checks/itertools/itertools8.py, which are the six files listed in [#100]. The reported changes add assertion messages and…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 6…
Full details: Linked Issues check

Explanation

For [#100], the summary supports seven non-empty f-string messages in the six specified files. It also reports expected and actual values and one-line changes per assertion. The available evidence does not show the required automated verification, including the 292 reference answers, the AST audit, or Python 3.9 compatibility. The whole-PR diff inspection was unavailable because the repository object could not be fetched.

Resolution

Provide reviewable verification evidence for the required test commands, the AST audit showing zero bare assertions in the six files, and Python 3.9 compatibility. Provide a complete whole-PR diff or equivalent evidence if the verification evidence does not establish unchanged predicates, ordering, side effects, and success output.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit reads each line,
The patch grows clear beneath the moon,
Small changes hop in place,
Tests guard the garden path,
Reviews bloom before the dawn.

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

curriculum: add actionable assertion messages to itertools checks

1 participant