コード例 #1
0
ファイル: test_bank.py プロジェクト: sarattall/finances
    def test_withdrawal_time_travel(self):
        t = 0
        b = BankAccount('Wells Fargo', 100, 1000, t)

        assert_equals(b.balance(t+4), 1000)
        b.withdraw(500, t+1)
        assert_equals(b.balance(t+2), 500)
        assert_equals(b.balance(t+3), 500)
        assert_equals(b.balance(t+4), 500)
コード例 #2
0
ファイル: test_bank.py プロジェクト: sarattall/finances
    def test_basic_withdrawal(self):
        t = 0
        b = BankAccount('Wells Fargo', 100, 200, t)
        assert_equals(b.balance(t+1), 200)

        b.withdraw(100, t+1)
        assert_equals(b.balance(t+1), 200)
        assert_equals(b.balance(t+2), 100)
        assert_equals(b.balance(t+10), 100)
        assert_equals(b.balance(t+100), 100)
コード例 #3
0
ファイル: test_bank.py プロジェクト: sarattall/finances
    def test_withdrawal_overdraft_prevention(self):
        t = 0
        b = BankAccount('Wells Fargo', 100, 200, t)
        assert_equals(b.balance(t), 0)
        assert_equals(b.balance(t+1), 200)

        b.withdraw(4000, t+1)
        assert_equals(b.balance(t+1), 200)
        assert_equals(b.balance(t+2), 200)
        assert_equals(b.balance(t+10), 200)
        assert_equals(b.balance(t+100), 200)