Exemplo n.º 1
0
def test_statement():
    checkingAccount = createBankAccount(CHECKING)
    savingsAccount = createBankAccount(SAVINGS)
    henry = Customer("Henry").openAccount(checkingAccount).openAccount(
        savingsAccount)
    checkingAccount.deposit(100.0)
    savingsAccount.deposit(4000.0)
    savingsAccount.withdraw(200.0)
    assert_equals(
        henry.getStatement(), "Statement for Henry" +
        "\n\nChecking Account\n  deposit $100.00\nTotal $100.00" +
        "\n\nSavings Account\n  deposit $4000.00\n  withdrawal $200.00\nTotal $3800.00"
        + "\n\nTotal In All Accounts $3900.00")
Exemplo n.º 2
0
def test_checking_account():
    bank = Bank()
    checkingAccount = createBankAccount(CHECKING)
    bill = Customer("Bill").openAccount(checkingAccount)
    bank.addCustomer(bill)
    checkingAccount.deposit(100.0, ONE_YEAR_AGO)
    assert_equals(bank.totalInterestPaid(), 0.1)
Exemplo n.º 3
0
def test_daily_accrued_interest(self):
    bank = Bank()
    checkingAccount = createBankAccount(CHECKING)
    bank.addCustomer(Customer("Bill").openAccount(checkingAccount))

    two_years_ago = datetime.datetime.today() - datetime.timedelta(days=730)
    checkingAccount.deposit(1000.0, transactionDate=two_years_ago)
    assert_equals(checkingAccount.interestEarned(), 2.0)

    checkingAccount.deposit(1000.0, transactionDate=ONE_YEAR_AGO)
    assert_almost_equals(checkingAccount.interestEarned(), 3.0, places=2)

    half_year_ago = datetime.datetime.today() - datetime.timedelta(days=182)
    checkingAccount.deposit(1000.0, transactionDate=half_year_ago)
    assert_almost_equals(checkingAccount.interestEarned(), 3.5, places=2)
Exemplo n.º 4
0
def test_savings_account(self):
    bank = Bank()
    checkingAccount = createBankAccount(SAVINGS)
    bank.addCustomer(Customer("Bill").openAccount(checkingAccount))
    checkingAccount.deposit(1500.0, ONE_YEAR_AGO)
    assert_equals(bank.totalInterestPaid(), 2.0)
Exemplo n.º 5
0
def test_customer_summary():
    bank = Bank()
    john = Customer("John").openAccount(createBankAccount(CHECKING))
    bank.addCustomer(john)
    assert_equals(bank.customerSummary(),
                  "Customer Summary\n - John (1 account)")
Exemplo n.º 6
0
def test_threeAccounts():
    oscar = Customer("Oscar").openAccount(createBankAccount(SAVINGS))
    oscar.openAccount(createBankAccount(CHECKING))
    assert_equals(oscar.numAccs(), 3)
Exemplo n.º 7
0
def test_oneAccount():
    oscar = Customer("Oscar").openAccount(createBankAccount(SAVINGS))
    assert_equals(oscar.numAccs(), 1)