-
Notifications
You must be signed in to change notification settings - Fork 29
Add Tests for PR#937 #939
Add Tests for PR#937 #939
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Changes have been made to critical files, which contain lines commonly executed in production. Learn more Additional details and impacted files@@ Coverage Diff @@
## codecov/unit-tests #939 +/- ##
======================================================
- Coverage 96.23% 95.78% -0.45%
======================================================
Files 823 758 -65
Lines 18972 15177 -3795
======================================================
- Hits 18257 14537 -3720
+ Misses 715 640 -75
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. 📢 Thoughts on this report? Let us know! |
|
@codecov-ai-reviewer hi |
| def test_deposit(self): | ||
| account = BankAccount("John Doe") | ||
| self.assertEqual(account.deposit(50.0), 50.0) | ||
| self.assertEqual(account.balance, 50.0) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deposit method should be tested with an initial balance to ensure it adds correctly to the existing balance.
| def test_deposit(self): | |
| account = BankAccount("John Doe") | |
| self.assertEqual(account.deposit(50.0), 50.0) | |
| self.assertEqual(account.balance, 50.0) |
| def test_transfer(self): | ||
| account1 = BankAccount("John Doe", 100.0) | ||
| account2 = BankAccount("Jane Doe", 50.0) | ||
| balance1, balance2 = account1.transfer(account2, 30.0) | ||
| self.assertEqual(balance1, 70.0) | ||
| self.assertEqual(balance2, 80.0) | ||
| self.assertEqual(account1.balance, 70.0) | ||
| self.assertEqual(account2.balance, 80.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The transfer method should be tested with an initial balance to ensure it transfers correctly between accounts.
| def test_transfer(self): | |
| account1 = BankAccount("John Doe", 100.0) | |
| account2 = BankAccount("Jane Doe", 50.0) | |
| balance1, balance2 = account1.transfer(account2, 30.0) | |
| self.assertEqual(balance1, 70.0) | |
| self.assertEqual(balance2, 80.0) | |
| self.assertEqual(account1.balance, 70.0) | |
| self.assertEqual(account2.balance, 80.0) |
Co-authored-by: codecov-ai[bot] <156709835+codecov-ai[bot]@users.noreply.github.com>
This PR adds tests for #937
Commits: