From b77d8f80e0977a03a9ca89e6da60a81f9b1ff7ce Mon Sep 17 00:00:00 2001 From: ai-bot Date: Sun, 15 Nov 2026 18:32:34 +0000 Subject: [PATCH] Cover that kroner move no figure and the bank is no row --- tests/test_tax.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/test_tax.py b/tests/test_tax.py index 26e073a..731247f 100644 --- a/tests/test_tax.py +++ b/tests/test_tax.py @@ -340,5 +340,37 @@ class TaxTestCase(unittest.TestCase): })) + def test_a_kroner_transfer_moves_no_figure(self): + source = create_market("Børs_01") + destination = create_market("Lommebok", kind="wallet") + create_transaction(market_id=source, date="2024-01-10", + leg_in_sats=100000000, leg_out_ore=20000000) + create_transaction(market_id=source, date="2024-02-10", + leg_in_ore=50000000, leg_out_sats=100000000) + ledger.rebuild() + before = tax.report(2024)["totals"] + create_transaction(market_id=source, date="2024-03-10", + type="transfer_out", leg_out_ore=10000000, + to_market_id=destination, transfer_group="group-1") + create_transaction(market_id=destination, date="2024-03-10", type="transfer_in", + leg_in_ore=10000000, to_market_id=source, + transfer_group="group-1", generated=1) + ledger.rebuild() + self.assertEqual(tax.report(2024)["totals"], before) + + def test_the_bank_is_no_account_row(self): + golden_market() + bank = create_market("Bank", kind="other", taxable=0) + create_transaction(market_id=bank, date="2024-12-01", type="admin_cost", + leg_out_ore=50000, leg_in_ore=50000) + database.set_setting("bank_market_id", str(bank)) + ledger.rebuild() + report = tax.report(2024) + self.assertEqual([row["name"] for row in report["accounts"]], ["Børs_01"]) + self.assertEqual(report["non_taxable"], []) + # The cost counts from its own flag, even though the bank is not taxable. + self.assertEqual(report["totals"]["admin_cost_ore"], 50000) + + if __name__ == "__main__": unittest.main()