# Path: core/tests/base.py
# class PanelViewProvider:
# class ApplicationGUI(CallLogger):
# class DocumentGUI(CallLogger):
# class ViewGUI(CallLogger):
# class MainWindowGUI(CallLogger):
# class DictLoader(base.Loader):
# class TestApp(TestAppBase):
#     def __init__(self):
#     def close_panel(self):
#     def _logify(cls, model, ignore=None):
#     def get_panel_view(self, model):
# def log(method):
#     def wrapper(self, *args, **kw):
#     def __init__(self):
#     def get_default(self, key): # We don't want to log this one. It disturbs other test and is pointless to log
#     def set_default(self, key, value):
#     def __init__(self):
#     def query_for_schedule_scope(self):
#     def __init__(self, panel_view_provider):
#     def get_panel_view(self, model):
#     def __init__(self, testapp):
#     def get_panel_view(self, model):
#     def show_message(self, message):
#     def refresh_panes(self):
#     def __init__(
#             self, default_currency, infos, default_date_format='%d/%m/%Y'):
#     def _parse(self, infile):
#     def _load(self):
#     def __init__(self, app=None, doc=None, appargs=None):
#     def link_gui(self, gui, logger=None):
#     def tmppath(self):
#     def check_current_pane(self, pane_type, account_name=None):
#     def check_gui_calls(gui, *args, **kwargs):
#     def check_gui_calls_partial(gui, *args, **kwargs):
#     def add_account(
#             self, name=None, currency=None, account_type=AccountType.Asset, group_name=None,
#             account_number=None, inactive=None):
#     def add_accounts(self, *names):
#     def add_entry(self, date=None, description=None, payee=None, transfer=None, increase=None,
#             decrease=None, checkno=None, reconciliation_date=None):
#     def add_group(self, name=None, account_type=AccountType.Asset):
#     def add_schedule(self, start_date=None, description='', account=None, amount='0',
#             repeat_type_index=0, repeat_every=1, stop_date=None):
#     def add_txn(self, date=None, description=None, payee=None, from_=None, to=None, amount=None,
#             checkno=None):
#     def add_txn_with_splits(self, splits, date=None, description=None, payee=None, checkno=None):
#     def account_names(self):
#     def account_node_subaccount_count(self, node):
#     def balances(self):
#     def bar_graph_data(self):
#     def close_and_load(self):
#     def change_selected_account(
#             self, name=None, currency=None, account_type=None, account_number=None, inactive=None):
#     def completable_edit(self, attrname):
#     def do_test_save_load(self):
#     def do_test_qif_export_import(self):
#     def entry_descriptions(self):
#     def etable_count(self):
#     def fake_import(self, account_name, transactions, account_reference=None):
#     def get_current_panel(self):
#     def graph_data(self):
#     def navigate_to_date(self, year, month, day):
#     def new_app_same_prefs(self):
#     def nw_graph_data(self):
#     def save_and_load(self):
#     def save_file(self):
#     def select_account(self, account_name):
#     def show_account(self, account_name=None):
#     def set_column_visible(self, colname, visible):
#     def transaction_descriptions(self):
#     def current_view(self):
#     def new_tab(self):
#     def link_aview(self):
#     def show_nwview(self):
#     def show_pview(self):
#     def show_tview(self):
#     def show_aview(self):
#     def show_scview(self):
#     def show_glview(self):
#     def show_dpview(self):
# def compare_apps(first, second, qif_mode=False):
#     def qif_normalize(t):
# def print_table(table, extra_attrs=[]):
#     def getval(row, attrname):
# def Amount(val, currency):
# 
# Path: core/const.py
# class AccountType:
#     """Enum of all possible account types.
# 
#     * ``Asset``
#     * ``Liability``
#     * ``Income``
#     * ``Expense``
# 
#     Special values:
# 
#     * ``All``: set containing all account types
#     * ``InOrder``: all account type in "sort" order.
#     """
#     Asset = 'asset'
#     Liability = 'liability'
#     Income = 'income'
#     Expense = 'expense'
#     InOrder = [Asset, Liability, Income, Expense]
#     All = set(InOrder)


from datetime import date
from ..testutil import eq_, with_app
from ..base import TestApp, testdata
from ...const import AccountType
from ...model.currency import Currencies
# Copyright 2019 Virgil Dupras
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html




class TestAssetsAndLiabilitiesInDifferentAccounts:
    def do_setup(self):
        app = TestApp()
        app.drsel.select_month_range()
        for i in range(1, 15):
            Currencies.get_rates_db().set_CAD_value(date(2008, 7, i), 'USD', 1.42)
        for i in range(15, 32):
            Currencies.get_rates_db().set_CAD_value(date(2008, 7, i), 'USD', 1.54)
        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')

# Path: core/tests/base.py
# class PanelViewProvider:
# class ApplicationGUI(CallLogger):
# class DocumentGUI(CallLogger):
# class ViewGUI(CallLogger):
# class MainWindowGUI(CallLogger):
# class DictLoader(base.Loader):
# class TestApp(TestAppBase):
#     def __init__(self):
#     def close_panel(self):
#     def _logify(cls, model, ignore=None):
#     def get_panel_view(self, model):
# def log(method):
#     def wrapper(self, *args, **kw):
#     def __init__(self):
#     def get_default(self, key): # We don't want to log this one. It disturbs other test and is pointless to log
#     def set_default(self, key, value):
#     def __init__(self):
#     def query_for_schedule_scope(self):
#     def __init__(self, panel_view_provider):
#     def get_panel_view(self, model):
#     def __init__(self, testapp):
#     def get_panel_view(self, model):
#     def show_message(self, message):
#     def refresh_panes(self):
#     def __init__(
#             self, default_currency, infos, default_date_format='%d/%m/%Y'):
#     def _parse(self, infile):
#     def _load(self):
#     def __init__(self, app=None, doc=None, appargs=None):
#     def link_gui(self, gui, logger=None):
#     def tmppath(self):
#     def check_current_pane(self, pane_type, account_name=None):
#     def check_gui_calls(gui, *args, **kwargs):
#     def check_gui_calls_partial(gui, *args, **kwargs):
#     def add_account(
#             self, name=None, currency=None, account_type=AccountType.Asset, group_name=None,
#             account_number=None, inactive=None):
#     def add_accounts(self, *names):
#     def add_entry(self, date=None, description=None, payee=None, transfer=None, increase=None,
#             decrease=None, checkno=None, reconciliation_date=None):
#     def add_group(self, name=None, account_type=AccountType.Asset):
#     def add_schedule(self, start_date=None, description='', account=None, amount='0',
#             repeat_type_index=0, repeat_every=1, stop_date=None):
#     def add_txn(self, date=None, description=None, payee=None, from_=None, to=None, amount=None,
#             checkno=None):
#     def add_txn_with_splits(self, splits, date=None, description=None, payee=None, checkno=None):
#     def account_names(self):
#     def account_node_subaccount_count(self, node):
#     def balances(self):
#     def bar_graph_data(self):
#     def close_and_load(self):
#     def change_selected_account(
#             self, name=None, currency=None, account_type=None, account_number=None, inactive=None):
#     def completable_edit(self, attrname):
#     def do_test_save_load(self):
#     def do_test_qif_export_import(self):
#     def entry_descriptions(self):
#     def etable_count(self):
#     def fake_import(self, account_name, transactions, account_reference=None):
#     def get_current_panel(self):
#     def graph_data(self):
#     def navigate_to_date(self, year, month, day):
#     def new_app_same_prefs(self):
#     def nw_graph_data(self):
#     def save_and_load(self):
#     def save_file(self):
#     def select_account(self, account_name):
#     def show_account(self, account_name=None):
#     def set_column_visible(self, colname, visible):
#     def transaction_descriptions(self):
#     def current_view(self):
#     def new_tab(self):
#     def link_aview(self):
#     def show_nwview(self):
#     def show_pview(self):
#     def show_tview(self):
#     def show_aview(self):
#     def show_scview(self):
#     def show_glview(self):
#     def show_dpview(self):
# def compare_apps(first, second, qif_mode=False):
#     def qif_normalize(t):
# def print_table(table, extra_attrs=[]):
#     def getval(row, attrname):
# def Amount(val, currency):
# 
# Path: core/const.py
# class AccountType:
#     """Enum of all possible account types.
# 
#     * ``Asset``
#     * ``Liability``
#     * ``Income``
#     * ``Expense``
# 
#     Special values:
# 
#     * ``All``: set containing all account types
#     * ``InOrder``: all account type in "sort" order.
#     """
#     Asset = 'asset'
#     Liability = 'liability'
#     Income = 'income'
#     Expense = 'expense'
#     InOrder = [Asset, Liability, Income, Expense]
#     All = set(InOrder)


# Path: core/tests/gui/net_worth_graph_test.py
from datetime import date
from ..testutil import eq_, with_app
from ..base import TestApp, testdata
from ...const import AccountType
from ...model.currency import Currencies

# Copyright 2019 Virgil Dupras
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html




class TestAssetsAndLiabilitiesInDifferentAccounts:
    def do_setup(self):
        app = TestApp()
        app.drsel.select_month_range()
        for i in range(1, 15):
            Currencies.get_rates_db().set_CAD_value(date(2008, 7, i), 'USD', 1.42)
        for i in range(15, 32):
            Currencies.get_rates_db().set_CAD_value(date(2008, 7, i), 'USD', 1.54)
        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)