Skip to content

🧪 Add unit tests for add function in calcfinalq2.py#14

Open
ManupaKDU wants to merge 1 commit into
mainfrom
improve-calc-add-tests-17389769983085354863
Open

🧪 Add unit tests for add function in calcfinalq2.py#14
ManupaKDU wants to merge 1 commit into
mainfrom
improve-calc-add-tests-17389769983085354863

Conversation

@ManupaKDU
Copy link
Copy Markdown
Contributor

🎯 What: The add function in Learning/Part-1/Python/calcfinalq2.py lacked proper unit tests. To make the code testable, the infinite input loop in calcfinalq2.py was refactored by wrapping it inside an if __name__ == "__main__": block.
📊 Coverage: A new test_calcfinalq2.py file was created using Python's unittest framework. It covers the add function by testing positive numbers, negative numbers, mixed inputs (negative + positive), floating point numbers, and zero.
Result: The codebase now correctly tests the add function in calcfinalq2.py and is protected from regressions without getting stuck in the input() loop when imported by the test suite. A basic .gitignore was also added to prevent __pycache__ artifacts from cluttering the version control system.


PR created automatically by Jules for task 17389769983085354863 started by @ManupaKDU

Refactored calcfinalq2.py to wrap the main execution loop in an
`if __name__ == '__main__':` block to prevent blocking infinite loops
when importing the file for tests.
Created test_calcfinalq2.py to test the `add` function with positive,
negative, mixed, and zero numeric values. Also added a .gitignore to
exclude __pycache__ binary files from tracking.

Co-authored-by: ManupaKDU <95234271+ManupaKDU@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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