Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Conversation

@seer-by-sentry
Copy link
Contributor

This PR adds tests for #937

Commits:

  • Add unit tests for BankAccount class

@seer-by-sentry seer-by-sentry bot mentioned this pull request Oct 29, 2024
@codecov
Copy link

codecov bot commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.78%. Comparing base (142a003) to head (068fcfc).
Report is 2 commits behind head on codecov/unit-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     
Flag Coverage Δ
unit ?
unit-latest-uploader ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codecov-notifications
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@rohitvinnakota-codecov rohitvinnakota-codecov marked this pull request as ready for review November 20, 2024 19:02
@rohitvinnakota-codecov
Copy link
Contributor

@codecov-ai-reviewer hi

Comment on lines +14 to +18
def test_deposit(self):
account = BankAccount("John Doe")
self.assertEqual(account.deposit(50.0), 50.0)
self.assertEqual(account.balance, 50.0)

Copy link
Contributor

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.

Suggested change
def test_deposit(self):
account = BankAccount("John Doe")
self.assertEqual(account.deposit(50.0), 50.0)
self.assertEqual(account.balance, 50.0)

Comment on lines +39 to +46
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)
Copy link
Contributor

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.

Suggested change
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>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants