Revised the code to read from the CSV data files in the __test_base_account_data method of the ConsoleCommandTestCase test case, to prevent PyCharm from complaining.

This commit is contained in:
依瑪貓 2023-06-10 10:32:33 +08:00
parent c60424f763
commit 80195eef5e

View File

@ -81,12 +81,13 @@ class ConsoleCommandTestCase(unittest.TestCase):
from accounting.models import BaseAccount
with open(data_dir / "base_accounts.csv") as fp:
rows: list[dict[str, str]] = list(csv.DictReader(fp))
data: dict[dict[str, Any]] \
= {x["code"]: {"code": x["code"],
"title": x["title"],
"l10n": {y[5:]: x[y]
for y in x if y.startswith("l10n-")}}
for x in csv.DictReader(fp)}
for x in rows}
with self.__app.app_context():
accounts: list[BaseAccount] = BaseAccount.query.all()