def do_setup(self):
     app = TestApp()
     app.drsel.select_month_range()
     for i in range(1, 15):
         USD.set_CAD_value(1.42, date(2008, 7, i))
     for i in range(15, 32):
         USD.set_CAD_value(1.54, date(2008, 7, i))
     app.add_account('asset1')
     app.show_account()
     app.add_entry('12/6/2008', increase='10') # previous balance
     app.add_entry('3/7/2008', increase='50')
     app.add_entry('5/7/2008', increase='80')
     app.add_account('asset2')
     app.show_account()
     app.add_entry('1/7/2008', increase='32')
     app.add_entry('5/7/2008', increase='22')
     app.add_account('liability1', CAD, account_type=AccountType.Liability)
     app.show_account()
     app.add_entry('1/7/2008', increase='10')
     app.add_account('liability2', account_type=AccountType.Liability)
     app.show_account()
     app.add_entry('8/7/2008', increase='100')
     app.show_nwview()
     app.clear_gui_calls()
     return app
示例#2
0
def test_seek_rate():
    # Trying to get rate around the existing date gives the rate in question.
    set_ratedb_for_tests()
    USD.set_CAD_value(0.98, date(2008, 5, 20))
    amount = Amount(42, USD)
    expected = Amount(42 * .98, CAD)
    eq_(convert_amount(amount, CAD, date(2008, 5, 21)), expected)
    eq_(convert_amount(amount, CAD, date(2008, 5, 19)), expected)
def app_multi_currency_transaction():
    app = TestApp()
    USD.set_CAD_value(0.8, date(2008, 1, 1))
    splits = [
        ('first', '', '', '44 usd'),
        ('second', '', '42 cad', ''),
    ]
    app.add_txn_with_splits(splits)
    app.mw.edit_item()
    app.stable.select([1])
    app.clear_gui_calls()
    return app
示例#4
0
def test_budget_multiple_currencies(app, monkeypatch):
    # budgeted amounts must be correctly converted to the target's currency
    monkeypatch.patch_today(2008, 1, 15)
    USD.set_CAD_value(0.8, date(2008, 1, 1))
    app.show_pview()
    app.istatement.selected = app.istatement.income[0]
    app.mw.edit_item()
    app.apanel.currency_list.select(Currency.all.index(CAD))
    app.apanel.save()
    app.add_budget('income', 'Account 1', '400 cad')
    app.show_nwview()
    eq_(app.bsheet.assets[0].end, '250.00')
    eq_(app.bsheet.assets[0].budgeted, '250.00') # 400 / 2 / 0.8 = 250
 def do_setup(self):
     app = TestApp(app=Application(ApplicationGUI(), default_currency=CAD))
     USD.set_CAD_value(0.8, date(2008, 1, 1))
     app.add_account('USD income', account_type=AccountType.Income, currency=USD)
     app.add_account('CAD income', account_type=AccountType.Income, currency=CAD)
     app.add_account('USD asset', currency=USD)
     app.show_account()
     app.add_entry('1/1/2008', 'USD entry', transfer='USD income', increase='1')
     app.add_account('CAD asset', currency=CAD)
     app.show_account()
     app.add_entry('1/1/2008', 'CAD entry', transfer='CAD income', increase='1')
     app.show_nwview()
     return app
示例#6
0
def app_multiple_currencies():
    app = TestApp(app=Application(ApplicationGUI(), default_currency=CAD))
    app.drsel.select_month_range()
    USD.set_CAD_value(0.8, date(2008, 1, 1))
    USD.set_CAD_value(0.9, date(2008, 1, 31))
    app.add_group('Group')
    app.add_account('USD account', currency=USD, group_name='Group')
    app.show_account()
    app.add_entry('1/1/2007', 'USD entry', increase='50.00')
    app.add_entry('1/1/2008', 'USD entry', increase='80.00')
    app.add_entry('31/1/2008', 'USD entry', increase='20.00')
    app.add_account('CAD account', currency=CAD, group_name='Group')
    app.show_account()
    app.add_entry('1/1/2008', 'USD entry', increase='100.00')
    app.show_nwview()
    return app
 def do_setup(self):
     app = TestApp(app=Application(ApplicationGUI(), default_currency=CAD))
     app.drsel.select_month_range()
     USD.set_CAD_value(0.8, date(2008, 1, 1))
     USD.set_CAD_value(0.9, date(2008, 1, 31))
     app.add_group('Group', account_type=AccountType.Income)
     app.add_account('CAD account', currency=CAD, account_type=AccountType.Income, group_name='Group')
     app.show_account()
     app.add_entry('1/1/2008', 'USD entry', increase='100.00')
     app.add_account('USD account', currency=USD, account_type=AccountType.Income, group_name='Group')
     app.show_account()
     app.add_entry('1/1/2007', 'USD entry', increase='50.00')
     app.add_entry('1/1/2008', 'USD entry', increase='80.00')
     app.add_entry('31/1/2008', 'USD entry', increase='20.00')
     app.show_pview()
     return app
示例#8
0
 def do_setup(self):
     app = TestApp()
     app.drsel.select_month_range()
     USD.set_CAD_value(1.42, date(2008, 7, 1))
     # in july 2008, the first mondy is the 7th
     app.add_account('asset')
     app.show_account()
     app.add_entry('12/6/2008', transfer='income1', increase='10') # will be ignored
     app.add_entry('3/7/2008', transfer='income1', increase='50') # 1st week
     app.add_entry('5/7/2008', transfer='income1', increase='80')
     app.add_entry('7/7/2008', transfer='income1', increase='90') # 2nd week
     app.add_entry('1/7/2008', transfer='income2', increase='32') # 1st week
     app.add_entry('5/7/2008', transfer='income2', increase='22')
     app.add_entry('15/7/2008', transfer='income2', increase='54') # 3rd week
     app.add_entry('1/7/2008', transfer='expense1', decrease='10 cad')
     app.add_entry('8/7/2008', transfer='expense2', decrease='100') # 2nd week
     app.show_pview()
     app.clear_gui_calls()
     return app
def app_three_way_multi_currency_transaction():
    app = TestApp()
    USD.set_CAD_value(0.8, date(2008, 1, 1))
    app.add_account('first')
    app.show_account()
    app.add_entry('11/07/2008', transfer='second', decrease='42')
    app.tpanel.load()
    app.stable.select([1])
    row = app.stable.selected_row
    row.debit = '20 cad'
    app.stable.save_edits()
    app.stable.add()
    row = app.stable.selected_row
    row.account = 'third'
    row.debit = '22 usd'
    app.stable.save_edits()
    app.tpanel.save()
    app.show_tview()
    return app
示例#10
0
 def setup_method(self, method):
     USD.set_CAD_value(1.1, date(2007, 12, 31))
     USD.set_CAD_value(0.9, date(2008, 1, 1))
     USD.set_CAD_value(0.8, date(2008, 1, 2))
     USD.set_CAD_value(0.7, date(2008, 1, 3))
     self.account = Account('Checking', USD, AccountType.Asset)
     accounts = AccountList(CAD)
     accounts.add(self.account)
     transactions = TransactionList([
         Transaction(date(2007, 12, 31), account=self.account, amount=Amount(20, USD)),
         Transaction(date(2008, 1, 1), account=self.account, amount=Amount(100, USD)),
         Transaction(date(2008, 1, 2), account=self.account, amount=Amount(50, USD)),
         Transaction(date(2008, 1, 3), account=self.account, amount=Amount(70, CAD)),
         Transaction(date(2008, 1, 31), account=self.account, amount=Amount(2, USD)),
     ])
     oven = Oven(accounts, transactions, [], [])
     oven.cook(date.min, date.max)
def app_multiple_currencies_over_two_months():
    app = TestApp(app=Application(ApplicationGUI(), default_currency=CAD))
    app.drsel.select_month_range()
    USD.set_CAD_value(0.8, date(2008, 1, 1))
    USD.set_CAD_value(0.9, date(2008, 1, 31))
    USD.set_CAD_value(0.9, date(2008, 2, 10))
    app.add_account('CAD account', currency=CAD, account_type=AccountType.Income)
    app.show_account()
    app.add_entry('1/1/2008', 'CAD entry', increase='200.00')
    app.add_entry('1/2/2008', 'CAD entry', increase='190.00')
    app.add_account('USD account', currency=USD, account_type=AccountType.Expense)
    app.show_account()
    app.add_entry('1/1/2008', 'USD entry', increase='50.00')
    app.add_entry('1/1/2008', 'USD entry', increase='80.00')
    app.add_entry('31/1/2008', 'USD entry', increase='20.00')
    app.add_entry('10/2/2008', 'USD entry', increase='100.00')
    app.show_pview()
    return app
def app_multiple_currencies():
    app = TestApp()
    USD.set_CAD_value(2, date(2010, 3, 9))
    app.add_txn('10/03/2010', amount='10')
    app.add_txn('10/03/2010', amount='10 CAD') # worth 5usd
    return app