Пример #1
0
    workbook = Workbook()
    # Get the current active worksheet
    ws = workbook.active
    ws.title = 'transactions'

    ws['A1'] = 'transaction type'
    ws['B1'] = 'amount'

    row = 2

    # Write out the transactions
    for transaction in account.history:
        ws['A' + str(row)] = transaction.action
        ws['B' + str(row)] = transaction.amount
        row += 1

    workbook.save(filename)

    print('Done Write Excel Example')


print('Starting')
acc = accounts.CurrentAccount('123', 'John', 10.05, 100.0)
acc.deposit(23.45)
acc.withdraw(12.33)

print('Writing Account Transactions')
write_account_transaction_to_excel('accounts.xlsx', acc)

print('Done')
Пример #2
0
def current_account():
    """Returns a CurrentAccount instance"""
    print('CurrentAccount fixture')
    return accounts.CurrentAccount('123', 'John', 0.0, 100.0)
Пример #3
0
import fintech.accounts as accounts

acc1 = accounts.CurrentAccount('123', 'John', 10.05, 100.0)
acc2 = accounts.DepositAccount('345', 'John', 23.55, 0.5)
acc3 = accounts.InvestmentAccount('567', 'Phoebe', 12.45, 'high risk')

print(acc1)
print(acc2)
print(acc3)

acc1.deposit(23.45)
acc1.withdraw(12.33)
print('balance:', acc1.balance)

print('Number of Account instances created:', accounts.Account.instance_count)

try:
    print('balance:', acc1.balance)
    acc1.withdraw(300.00)
    print('balance:', acc1.balance)
except accounts.BalanceError as e:
    print('Handling Exception')
    print(e)

with accounts.CurrentAccount ('891', 'Adam', 5.0, 50.0) as acc:
    acc.deposit(23.0)
    acc.withdraw(12.50)
    print(acc.balance)
Пример #4
0
def test_negative_opening_balance():
    current_account = accounts.CurrentAccount('123', 'John', -10.0, 100.0)
    assert current_account.balance == -10.00