20 lines
481 B
Python
20 lines
481 B
Python
from bankclass import SavingsAccount
|
|
import unittest
|
|
|
|
class TestBankClass(unittest.TestCase):
|
|
|
|
def setUp(self):
|
|
self.acc = SavingsAccount("Alice", 1000, 0.05)
|
|
|
|
def test_apply_interest(self):
|
|
self.assertEqual(self.acc.apply_interest(), 1050)
|
|
|
|
def test_savings_withdraw(self):
|
|
self.acc.withdraw(400)
|
|
self.assertEqual(self.acc.balance, 600)
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|
|
|
|
# ---
|
|
# now do with higher level pytests instead |