Skip to content

Add unit tests for StudentManager#16

Merged
swaparup36 merged 3 commits intocyclohexane-2:mainfrom
Rathore-tech-code:add-studentmanager-tests
Dec 9, 2025
Merged

Add unit tests for StudentManager#16
swaparup36 merged 3 commits intocyclohexane-2:mainfrom
Rathore-tech-code:add-studentmanager-tests

Conversation

@Rathore-tech-code
Copy link
Contributor

@Rathore-tech-code Rathore-tech-code commented Dec 7, 2025

Overview

This PR adds unit tests for the StudentManager class.

What was added

✔ Tests for adding assignments
✔ Tests for marking assignments as completed
✔ GPA calculation validation
✔ Invalid grade handling (raises ValueError)
✔ Student statistics calculation

Result

All tests pass successfully using python -m pytest.

Fixes #6

Please review and merge 😊

Copy link
Contributor

@swaparup36 swaparup36 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider grouping related tests in classes and use @pytest.fixture for common setup. Moreover -

  1. Add some more testcases for edge cases - like with negative values, empty strings or values outside the boundary.
  2. Write tests for past deadline scenarios.
  3. Add test cases for duplicate and non-existent data
  4. Consider empty collection operations

@Rathore-tech-code
Copy link
Contributor Author

Hi!
I have pushed updated tests as per feedback (fixtures, grouping, edge cases).
All 20 tests pass successfully.

Please review again.

@swaparup36
Copy link
Contributor

@Rathore-tech-code Good job! Just few more test cases like on TestAssignments - add assignment with null title, add assignment with past deadline. Please add tests for these two cases as well.

@Rathore-tech-code
Copy link
Contributor Author

Added requested tests (None title + past deadline).
All 22 tests passing successfully.
Kindly review again .

@swaparup36
Copy link
Contributor

LGTM. Nice work. thanks!

@swaparup36 swaparup36 merged commit a5f2f16 into cyclohexane-2:main Dec 9, 2025
"Old HW", past_deadline, "History"
)

assert assignment in student_manager.assignments
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why assert?

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.

Add Unit Tests for StudentManager Class

3 participants