Run pre-commit

This commit is contained in:
Gabriel Augendre 2021-11-18 19:06:40 +01:00
parent 766ca78ef5
commit 6c07799e20
16 changed files with 27 additions and 18 deletions

View file

@ -1,7 +1,7 @@
import click import click
from ofx_processor.utils import ynab from ofx_processor.utils import ynab
from ofx_processor.utils.utils import discover_processors, OrderedGroup from ofx_processor.utils.utils import OrderedGroup, discover_processors
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"]) CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])

View file

@ -1,6 +1,6 @@
import re import re
from ofx_processor.utils.base_ofx import OfxBaseProcessor, OfxBaseLine from ofx_processor.utils.base_ofx import OfxBaseLine, OfxBaseProcessor
class CeLine(OfxBaseLine): class CeLine(OfxBaseLine):

View file

@ -5,7 +5,7 @@ import sys
import click import click
import dateparser import dateparser
from ofx_processor.utils.base_processor import BaseProcessor, BaseLine from ofx_processor.utils.base_processor import BaseLine, BaseProcessor
def _amount_str_to_float(amount: str): def _amount_str_to_float(amount: str):

View file

@ -44,6 +44,12 @@ pre-commit = "^2.15.0"
[tool.poetry.scripts] [tool.poetry.scripts]
ynab = 'ofx_processor.main:cli' ynab = 'ofx_processor.main:cli'
[tool.black]
target-version = ['py38']
[tool.isort]
profile = "black"
[build-system] [build-system]
requires = ["poetry>=0.12"] requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api" build-backend = "poetry.masonry.api"

View file

@ -76,7 +76,7 @@
"date": "2020-01-05", "date": "2020-01-05",
"amount": -123680, "amount": -123680,
"payee_name": "Company 1", "payee_name": "Company 1",
"memo": "Shopping - FX-rate €1=US$1,1158", "memo": "Shopping - FX-rate \u20ac1\u2008=\u2008US$1,1158",
"import_id": "YNAB:-123680:2020-01-05:1", "import_id": "YNAB:-123680:2020-01-05:1",
"account_id": "<YOUR REVOLUT ACCOUNT ID>", "account_id": "<YOUR REVOLUT ACCOUNT ID>",
"cleared": "cleared" "cleared": "cleared"

View file

@ -7,8 +7,7 @@ from unittest.mock import call
from click.testing import CliRunner from click.testing import CliRunner
from ofx_processor.utils import utils from ofx_processor.utils import utils, ynab
from ofx_processor.utils import ynab
from ofx_processor.utils.ynab import config from ofx_processor.utils.ynab import config
@ -77,7 +76,11 @@ class ConfigTestCase(unittest.TestCase):
self.cli, ["revolut", "tests/samples/revolut.csv", "--keep"] self.cli, ["revolut", "tests/samples/revolut.csv", "--keep"]
) )
expected_filename = ynab.get_config_file_name() expected_filename = ynab.get_config_file_name()
self.assertIn("Error while parsing config file", result.output, f"config_file: {name}") self.assertIn(
"Error while parsing config file",
result.output,
f"config_file: {name}",
)
edit.assert_called_with(filename=expected_filename) edit.assert_called_with(filename=expected_filename)
@mock.patch("ofx_processor.utils.ynab.DEFAULT_CONFIG_FILENAME", "file.ini") @mock.patch("ofx_processor.utils.ynab.DEFAULT_CONFIG_FILENAME", "file.ini")

View file

@ -3,9 +3,9 @@ import json
import unittest import unittest
from ofx_processor.processors.revolut import ( from ofx_processor.processors.revolut import (
_amount_str_to_float,
RevolutLine, RevolutLine,
RevolutProcessor, RevolutProcessor,
_amount_str_to_float,
) )