Skip to content

fix: add messages to functional assertions - #151

Open
SwetaKumari7 wants to merge 1 commit into
abhiksark:devfrom
SwetaKumari7:improve-assertion-messages
Open

SwetaKumari7 wants to merge 1 commit into
abhiksark:devfrom
SwetaKumari7:improve-assertion-messages

Conversation

@SwetaKumari7

@SwetaKumari7 SwetaKumari7 commented Sep 18, 2026 •

Copy link
Copy Markdown

Summary

  • Add actionable messages to all previously bare assertions in functional checks.
  • Include the actual value where useful.
  • Preserve the existing assertion predicates, order, helper statements, and success output.

Verification

  • python -m pytest tests/integration/test_solution_verify.py -q
  • pythonlings --root tests/fixtures/passing_curriculum verify
  • AST audit confirms 0 bare assertions across functional1.py through functional6.py.
  • git diff --check passes.

Closes #86

Thank you for reviewing this contribution. Any feedback or suggestions are welcome.

Summary by CodeRabbit

  • Tests
    • Improved functional test failure messages with clearer details about expected and actual values and types.
    • Enhanced boundary and lambda test diagnostics without changing validation logic or expected results.

@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Review in 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: 0e123eb8-3212-4cc7-a4ca-a57bdbf54902
📥 Commits

Reviewing files that changed from the base of the PR and between 7bd85bf and 9160845.

📒 Files selected for processing: 6
  • checks/functional/functional1.py
  • checks/functional/functional2.py
  • checks/functional/functional3.py
  • checks/functional/functional4.py
  • checks/functional/functional5.py
  • checks/functional/functional6.py

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

📜 Recent review details
🧰 Additional context used
📚 Code guidelines: 1
AGENTS.md — unknown
📓 Path-based instructions: 3
Maintain Python 3.9 compatibility.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • checks/functional/functional1.py
  • checks/functional/functional3.py
  • checks/functional/functional2.py
  • checks/functional/functional6.py
  • checks/functional/functional4.py
  • checks/functional/functional5.py
Preserve learner-edited exercises during workspace updates.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • checks/functional/functional1.py
  • checks/functional/functional3.py
  • checks/functional/functional2.py
  • checks/functional/functional6.py
  • checks/functional/functional4.py
  • checks/functional/functional5.py
Checks must use bare assertions with actionable, beginner-facing messages.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • checks/functional/functional1.py
  • checks/functional/functional3.py
  • checks/functional/functional2.py
  • checks/functional/functional6.py
  • checks/functional/functional4.py
  • checks/functional/functional5.py
🪛 Ruff (0.16.10)
checks/functional/functional1.py

[error] 3-3: Undefined name square

(F821)

checks/functional/functional3.py

[error] 2-2: Undefined name doubled

(F821)

checks/functional/functional2.py

[error] 3-3: Undefined name absolute

(F821)

[error] 4-4: Undefined name absolute

(F821)

checks/functional/functional6.py

[error] 7-7: Undefined name apply_twice

(F821)

[error] 9-9: Undefined name apply_twice

(F821)

checks/functional/functional4.py

[error] 2-2: Undefined name evens

(F821)

[error] 3-3: Undefined name evens

(F821)

checks/functional/functional5.py

[error] 4-4: Undefined name by_length

(F821)

[error] 5-5: Undefined name by_length

(F821)

🔇 Additional comments: 6
checks/functional/functional1.py: 1

3-3: LGTM!

checks/functional/functional2.py: 1

3-4: LGTM!

checks/functional/functional3.py: 1

2-2: LGTM!

checks/functional/functional4.py: 1

2-4: LGTM!

checks/functional/functional5.py: 1

4-6: LGTM!

checks/functional/functional6.py: 1

7-11: LGTM!

📝 Walkthrough

Six functional check files now provide diagnostic messages when assertions fail. The assertions retain their existing checks and expected results.

Changes: Functional check diagnostics

Layer / File(s) Summary
Assertion failure messages
checks/functional/functional1.py, checks/functional/functional2.py, checks/functional/functional3.py, checks/functional/functional4.py, checks/functional/functional5.py, checks/functional/functional6.py
Assertions now report expected behavior or values when they fail. The checks and success output remain unchanged.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other · Severity of issue fixed: Low

Suggested reviewers: abhiksark

Merge Risk: ⚪ Minimal · up to 91608

The change improves failure diagnostics without altering functional check behavior.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive Issue #86 requires nine non-empty, actionable messages, unchanged predicates and order, unchanged side effects and success output, Python 3.9 compatibility, and passing verification for all 292 refere… Provide evidence from python -m pytest -q and verification of all 292 reference answers. The current evidence does not establish those acceptance criteria.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: adding messages to functional assertions.
Description check Passed The description explains the change, lists verification commands and audits, and references the related issue. It uses a "Verification" heading instead of the template's "Tests" heading and omits the …
Out of Scope Changes check Passed The complete merge-base-to-head diff changes only checks/functional/functional1.py through checks/functional/functional6.py, which are the six files listed by issue #86. The changes add assertion …
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: Description check

Explanation

The description explains the change, lists verification commands and audits, and references the related issue. It uses a "Verification" heading instead of the template's "Tests" heading and omits the "Screenshots" and "Checklist" sections, but it provides the key implementation and testing information.

Full details: Out of Scope Changes check

Explanation

The complete merge-base-to-head diff changes only checks/functional/functional1.py through checks/functional/functional6.py, which are the six files listed by issue #86. The changes add assertion messages and do not modify exercises, solutions, hints, URLs, manifest order, names, or curriculum semantics.

Full details: Docstring Coverage

Explanation

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 files.

Full details: Linked Issues check

Explanation

Issue #86 requires nine non-empty, actionable messages, unchanged predicates and order, unchanged side effects and success output, Python 3.9 compatibility, and passing verification for all 292 reference answers. The complete diff shows messages on all nine assertions in the six listed files. It also preserves the assertion expressions, order, and print statements. The added syntax is Python 3.9 compatible. The reported verification covers the integration test and passing curriculum fixture, but it does not establish that all 292 reference answers and the full required test suite pass.

Resolution

Provide evidence from python -m pytest -q and verification of all 292 reference answers. The current evidence does not establish those acceptance criteria.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 checks each test with care,
Clear messages wait when things go wrong.
The expected values now appear,
The checks still follow their original song.
The rabbit hops along, content.

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

@SwetaKumari7

Copy link
Copy Markdown
Author

@coderabbitai review

Hi, could you please review this PR when you get a chance? I've added actionable messages to the functional assertions while preserving the existing assertion logic and order. Thank you for your time and feedback!

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

This branch has not been deployed

No deployments
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.

1 participant