コード例 #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")
コード例 #2
0
ファイル: bank_tests.py プロジェクト: dfit99/abc-bank-python
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)
コード例 #3
0
ファイル: bank_tests.py プロジェクト: dfit99/abc-bank-python
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)
コード例 #4
0
ファイル: bank_tests.py プロジェクト: dfit99/abc-bank-python
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)
コード例 #5
0
ファイル: bank_tests.py プロジェクト: dfit99/abc-bank-python
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)")
コード例 #6
0
def test_threeAccounts():
    oscar = Customer("Oscar").openAccount(createBankAccount(SAVINGS))
    oscar.openAccount(createBankAccount(CHECKING))
    assert_equals(oscar.numAccs(), 3)
コード例 #7
0
def test_oneAccount():
    oscar = Customer("Oscar").openAccount(createBankAccount(SAVINGS))
    assert_equals(oscar.numAccs(), 1)