Skip to content

Commit

Permalink
fix flake8 and isort
Browse files Browse the repository at this point in the history
  • Loading branch information
markferry committed Sep 13, 2021
1 parent ab4ea25 commit 1f710c7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/tariochbctools/importers/test_truelayer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import pytest

from beancount.core.amount import Amount as A, Decimal as D
import pytest
from beancount.core.amount import Decimal as D

from tariochbctools.importers.truelayer import importer as tlimp

Expand Down Expand Up @@ -36,13 +36,15 @@
}
"""


@pytest.fixture(name="importer")
def truelayer_importer_fixture():
importer = tlimp.Importer()
# TODO: _configure the importer
importer.baseAccount = "Liabilities:Other"
yield importer


@pytest.fixture(name="tmp_config")
def tmp_config_fixture(tmp_path):
config = tmp_path / "truelayer.yaml"
Expand All @@ -60,12 +62,16 @@ def test_identify(importer, tmp_config):


def test_extract_transaction_simple(importer, tmp_trx):
entries = importer._extract_transaction(tmp_trx, "GBP", [tmp_trx], invert_sign=False)
entries = importer._extract_transaction(
tmp_trx, "GBP", [tmp_trx], invert_sign=False
)
assert entries[0].postings[0].units.number == D(str(tmp_trx["amount"]))


def test_extract_transaction_with_balance(importer, tmp_trx):
entries = importer._extract_transaction(tmp_trx, "GBP", [tmp_trx], invert_sign=False)
entries = importer._extract_transaction(
tmp_trx, "GBP", [tmp_trx], invert_sign=False
)
# one entry, one balance
assert len(entries) == 2
assert entries[1].amount.number == D(str(tmp_trx["running_balance"]["amount"]))
Expand Down

0 comments on commit 1f710c7

Please sign in to comment.