Skip to content

R35-T038: Cover the failure behavior of starPattern (starPattern.py) - #68

Closed
suraj-3010 wants to merge 1 commit into
S-AI-Projects:mainfrom
suraj-3010:student/e26b07f1007/R35-T038
Closed

suraj-3010 wants to merge 1 commit into
S-AI-Projects:mainfrom
suraj-3010:student/e26b07f1007/R35-T038

Conversation

@suraj-3010

Copy link
Copy Markdown

Description

This PR formalizes and verifies the empty/absent-result failure branch of starPattern in Star Pattern/starPattern.py, documenting the total contract, ensuring no unhandled exceptions are raised on non-positive input, and confirming that caller state remains uncorrupted.

Related Issue

Fixes: #38

Type of Change

  • Bug Fix
  • New Feature
  • UI/UX Improvement
  • Performance Improvement
  • Tests
  • Documentation
  • Refactoring / Maintenance
  • CI/CD

Changes Made

  • Added failure/absent-result contract docstrings to starPattern in Star Pattern/starPattern.py, documenting behavior when n <= 0 (empty loop yielding zero rows and "").
  • Wrapped interactive execution in if __name__ == '__main__': with safe input parsing.
  • Added unit tests in Star Pattern/test_star_pattern.py covering smallest valid input (n=1), ordinary input (n=3), absent-result branch (n=0 and n=-5), and caller state recovery.
  • Added work/R35-T038/check.py runner and work/R35-T038/evidence.md.

Screenshots / Recordings

There is no UI change.

Testing

  1. Ran python3 work/R35-T038/check.py: PASS (smallest input, ordinary input, absent-result branch, recovery, and 4 unittest test cases passed).
  2. Ran FORCE_WRONG=1 python3 work/R35-T038/check.py: FAIL (exited with code 1 upon deliberate value mismatch).
  3. Ran python3 -m unittest "Star Pattern/test_star_pattern.py": PASS (4 tests ran in 0.000s, OK).

Checklist

  • I have tested my changes locally.
  • I have added or updated tests, if needed.
  • I have updated documentation, if needed.
  • I have followed the project's coding guidelines.
  • I have run the relevant tests and checks.
  • I have addressed previous review feedback, if applicable.

Additional Notes

Evidence and check artifacts are recorded under work/R35-T038/.

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

Labels

None yet

1 participant