Closed lasuk closed 2 days ago
TestLedger
at all.Motivation: Base test has mock data already integrated and together with MemoryLedger that is all we need.
TestLedger
and Updating test_standalone_ledger.py
Drop Redundant Tests:
test_standardize_ledger_columns
and test_standardize_ledger_columns_ensure_date_type
, as enforce_schema
covers this functionality.test_add_ledger_entry
since StandaloneLedger
does not implement accessor or mutator methods.Retain Temporarily:
test_tax_journal_entries
and test_validate_account_balance
until base tests are implemented, after which these will be removed.Set up specific ACCOUNTS
and TAX_CODES
data to support remaining tests:
ACCOUNTS = pd.concat([
BaseTest.ACCOUNTS.query("account == 9992").assign(account=1020),
BaseTest.ACCOUNTS.query("account == 9992").assign(account=1030),
BaseTest.ACCOUNTS.query("account == 9992").assign(account=1045),
BaseTest.ACCOUNTS.query("account == 9992").assign(account=1170),
BaseTest.ACCOUNTS.query("account == 9992").assign(account=2200),
BaseTest.ACCOUNTS.query("account == 9992").assign(account=3000),
BaseTest.ACCOUNTS.query("account == 9992").assign(account=6000, tax_code="InStd"),
BaseTest.ACCOUNTS.query("account == 9992").assign(account=6100, tax_code="InStd"),
BaseTest.ACCOUNTS.query("account == 9992").assign(account=6200, tax_code="InStd"),
BaseTest.ACCOUNTS.query("account == 9992").assign(account=6300, tax_code="InStd"),
BaseTest.ACCOUNTS.query("account == 9992").assign(account=6400, tax_code="InStd"),
BaseTest.ACCOUNTS.query("account == 9992").assign(account=6500, tax_code="InStd"),
], ignore_index=True)
TAX_CODES = pd.concat([
BaseTest.TAX_CODES.query("id == 'Test'").assign(id="Exempt", account=None, rate=0),
BaseTest.TAX_CODES.query("id == 'OutStdEx'").assign(account=2200),
BaseTest.TAX_CODES.query("id == 'InStd'").assign(account=1170),
], ignore_index=True)
BaseTest
data. Using CSV offers clarity and reveals actual data content, making it more understandable and maintainable. This setup is temporary and will be removed at the end.Reassign Tests:
test_rounding_XY
tests to assets base tests, as this logic belongs there.Final Clean-up:
test_standalone_ledger.py
entirely by the end of the project.StandaloneLedger
to Use Accessors Instead of Private VariablesDrop All Class Variables Storing Data:
StandaloneLedger
that are currently holding data. This will eliminate direct data dependencies within the class.Replace Variable Usage with Accessor Methods:
Architectural Consideration for StandaloneLedger
:
StandaloneLedger
should remain in the class hierarchy, as its methods could potentially be integrated into LedgerEngine
. He would like your perspective on the necessity of StandaloneLedger
. If there are specific functionalities or conceptual distinctions that justify keeping it, highlighting those reasons will help clarify its role.
Description
TestLedger
shall now inherit fromMemoryLedger
. It shall have a sole method:populate_mock_data()
orload_sample_data()
that loads mock accounting data of a fictional Swiss company from CSV files available in the PyLedger package.Tasks:
TestLedger
to inherit fromMemoryLedger
. Drop unneeded methods.TestLedger
as CSV files in the PyLedger package instead of hard-coding the data in TestLedger.populate_mock_data()
orload_sample_data()
that loads the mock accounting available in the PyLedger package. Use theLedgerEngine.restore()
to load the data.