Пример #1
0
 def test_opening_balance(self):
     account = BankAccount(balance=100)
     self.assertEqual(account.balance, 100)
Пример #2
0
 def test_deposit(self):
     account1 = BankAccount()
     account1.deposit(3400)
     self.assertEqual(account1.account_balance, 3900)
Пример #3
0
 def test_invalid_transaction(self):
     account1 = BankAccount()
     self.assertEqual(account1.withdraw(1000), "Your account balance is insufficient")
Пример #4
0
 def test_close_already_closed_account(self):
     account = BankAccount()
     with self.assertRaisesWithMessage(ValueError):
         account.close()
 def setUp(self):
     self.account1 = BankAccount('Ivo', 0, 'BGN')
     self.account2 = BankAccount('Rado', 1000, 'BGN')
Пример #6
0
 def _create_default_account(self):
     self.accounts = {"primary": BankAccount(int_rate=0.02, balance=0)}
Пример #7
0
 def test_newly_opened_account_has_zero_balance(self):
     account = BankAccount()
     account.open()
     self.assertEqual(account.get_balance(), 0)
Пример #8
0
 def setUp(self):
     self.account = BankAccount("Rado", 1000, "$")
Пример #9
0
from bank_account import BankAccount

# accounts
account1 = BankAccount('John', 'Doe')
account2 = BankAccount('Jane', 'Doe')
account3 = BankAccount('Test', 'User')

#account1.deposit(1000)
account3.deposit(2000)
print(account3.account_detail)
account3.withdraw(1000)

#print(account1.account_detail)
#print()
print(account3.account_detail)
print()
print('Total accounts: {}'.format(BankAccount.accounts))
Пример #10
0
 def test_new_account_balance_default(self):
     account = BankAccount()
     self.assertEqual(account.balance, 0)
Пример #11
0
__author__ = 'vikram'

from bank_account import BankAccount

account = BankAccount()
account.deposit(40)

print(account)


def exclude(pred_func, full_list):
    exc_list = []
    for n in full_list:
        if not pred_func(n):
            exc_list.append(n)
    return exc_list


print exclude(lambda x: len(x) > 3, ["red", "blue", "green"])
print exclude(bool, [False, True, False])


def call(some_func, *args):
    print args
    return some_func(*args)


print call(int)
print call(len, "hello")
Пример #12
0
 def test_transfer(self):
     mary_account = BankAccount(balance=100)
     dana_account = BankAccount(balance=0)
     mary_account.transfer(dana_account, 20)
     self.assertEqual(mary_account.balance, 80)
     self.assertEqual(dana_account.balance, 20)
Пример #13
0
 def test_withdraw(self):
     account = BankAccount(balance=100)
     account.withdraw(40)
     self.assertEqual(account.balance, 60)
Пример #14
0
 def test_deposit(self):
     account = BankAccount()
     account.deposit(100)
     self.assertEqual(account.balance, 100)
Пример #15
0
 def set_up(self):
     self.account = BankAccount()
     self.printed_text = ''
Пример #16
0
 def test_close_already_closed_account(self):
     account = BankAccount()
     with self.assertRaises(ValueError) as err:
         account.close()
     self.assertEqual(type(err.exception), ValueError)
     self.assertEqual(err.exception.args[0], "account not open")
Пример #17
0
 def add_account(self, account_name, int_rate, balance):
     self.append({account_name: BankAccount(int_rate=int_rate, balance=balance)})
     return self
Пример #18
0
 def __init__(self, username, email_address):
     self.name = username
     self.email = email_address
     self.account = BankAccount(0.02, 0)
Пример #19
0
    def test_cannot_deposit_negative(self):
        account = BankAccount()
        account.open()

        with self.assertRaisesWithMessage(ValueError):
            account.deposit(-50)
Пример #20
0
from bank_account import BankAccount, SpecialBankAccount
from employee import Employee


if __name__ == '__main__':
    ba = BankAccount('ING', 100)
    print(ba.bank_name)
    print(ba.balance)

    ba.deposit(100)
    ba.withdraw(150)
    print(ba.balance)

    try:
        ba.withdraw(100)
    except Exception as ex:
        print(ex)
    print(ba.balance)

    e = Employee('Alin', ba)
    print(e.name.upper())
    print(e.bank_account.balance)

    print(e.salary)
    e.salary = 800
    print(e.salary)

    e.receive_salary()
    print(e.bank_account.balance)

    sba = SpecialBankAccount('BCR', 100, 200)
Пример #21
0
 def test_can_deposit_money(self):
     account = BankAccount()
     account.open()
     account.deposit(100)
     self.assertEqual(account.get_balance(), 100)
Пример #22
0
 def setUp(self):
     self.account_yangu = BankAccount()
Пример #23
0
 def test_open_already_opened_account(self):
     account = BankAccount()
     account.open()
     with self.assertRaisesWithMessage(ValueError):
         account.open()
Пример #24
0
from bank_account import BankAccount

main_account = BankAccount("DE123", "Marko")

savings_account = BankAccount("DE4432", "Marko")

main_account.booking(2000, "€", "Salary")
main_account.booking(-15.50, "€", "Amazon Book")

print(
    f"Owner: {main_account.owner_name}, IBAN: {main_account.iban}, Bookings: {main_account.bookings}"
)
print(f"Balance: {main_account.get_balance()}")
Пример #25
0
 def test_balance(self):
     account1 = BankAccount()
     self.assertEqual(account1.account_balance, 500)
Пример #26
0
    @property
    def phone(self) -> str:
        return self._phone

    @phone.setter
    def phone(self, phone: str):
        self._phone = phone


if __name__ == "__main__":
    p1 = Person("Jake Kelly", "*****@*****.**", "12341234")
    p2 = Person("Cooper Kelly", "*****@*****.**", "34563456")
    p3 = Person("Sally Kelly", "*****@*****.**", "56785678")

    acc1 = BankAccount()
    acc2 = BankAccount()

    acc1.transactions.append(100)
    acc1.transactions.append(100)
    acc1.transactions.append(-50)
    print(sum(acc1.transactions))

    acc2.transactions.append(200)
    acc2.transactions.append(500)
    acc2.transactions.append(-50)

    # for p in [p1, p2, p3]:
    #     print(f"{p.name}, {p.phone} {p.email}")

    # p2.email = "*****@*****.**"
Пример #27
0
 def test_withdraw(self):
     account1 = BankAccount()
     account1.withdraw(100)
     self.assertEqual(account1.account_balance, 400)
Пример #28
0
 def setUp(self):
     self.my_account = BankAccount()
Пример #29
0
 def test_sub_class(self):
     account1 = BankAccount()
     self.assertTrue(issubclass(LeastBalance, BankAccount))
Пример #30
0
 def test_can_withdraw_money(self):
     account = BankAccount()
     account.open()
     account.deposit(100)
     account.withdraw(50)
     self.assertEqual(account.get_balance(), 50)