-
Notifications
You must be signed in to change notification settings - Fork 29
Add bank account class #937
Conversation
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #937 +/- ##
==========================================
- Coverage 96.23% 96.05% -0.18%
==========================================
Files 823 829 +6
Lines 18972 20424 +1452
==========================================
+ Hits 18257 19619 +1362
- Misses 715 805 +90
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
📢 Thoughts on this report? Let us know! |
|
@codecov-ai-reviewer hi |
| def transfer(self, other_account, amount): | ||
| if not isinstance(other_account, BankAccount): | ||
| raise ValueError("Recipient must be a BankAccount instance") | ||
| self.withdraw(amount) | ||
| other_account.deposit(amount) | ||
| return self.balance, other_account.balance |
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 handle the case where the transfer fails due to insufficient funds or other reasons. Currently, if self.withdraw(amount) raises an exception, the other_account.deposit(amount) will not be executed, but the exception will not be caught or handled.
| def transfer(self, other_account, amount): | |
| if not isinstance(other_account, BankAccount): | |
| raise ValueError("Recipient must be a BankAccount instance") | |
| self.withdraw(amount) | |
| other_account.deposit(amount) | |
| return self.balance, other_account.balance |
|
✅ All tests successful. No failed tests were found. 📣 Thoughts on this report? Let Codecov know! | Powered by Codecov |
This PR adds a class to process transactions.