From cd726427dc9634684f6c0d0f4602d9459a5157a3 Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Wed, 2 Oct 2024 12:34:16 +0200 Subject: [PATCH] added test script --- budgets/Budget-Vorlage-2024.xlsx | Bin 0 -> 14373 bytes pyproject.toml | 9 +++++- superx_budget/__init__.py | 48 +++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 budgets/Budget-Vorlage-2024.xlsx diff --git a/budgets/Budget-Vorlage-2024.xlsx b/budgets/Budget-Vorlage-2024.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..b063b76be28aed564a4110d77260ef0be229af40 GIT binary patch literal 14373 zcmeHuWmp}_w)V!|-QC^Y-Q6{~+XjNW2AAOOPH+hlB*7tgkPRVNaCiHdnRD)(lbP?H z`~TkFyStx$y4UJeRqtA>y6P=e1qet?05kv=0058y#CSrcoWKA8NGJdR0{{zdAmQxf zZt3K1qUr5o2{dB%a&#aqf&`~60D!+f|9{*6;u@&Y9C7MrMeWwv7m@7IjxLO>s)8l# zBs8G>36tTKtV`LtjYs?FPh+K~)d1T^rRFeYKz$*ITf0oHCoa0_zjeiokN?lJ{w4+#hiK*M~B&<+R=PZBDX&} zgIQqIV1vgmK_Y5f16JY4PJ+l00f*YahIvkE9R$rn0qPuWXNMnH_VP15kiqTD-K=Z% zFnJURnNEz=Do~kkeA{8Sm4I-O3A{Mu94@VmW*XJEJXF4cd-lS$^t*CqEV;l5p883e z$Ch~J-5mxCj6k&o0oFQ?&@KsqwctPD&Mviia87X^Qjz25czF|YmI3K+-{2(G@n0cA z1|uFyxY>NWjwQUSUO@)s7KxF3Pdh^mlp_t>c6>Zixw-zc46q_boX9>#4&Tg!5>dq!-ipb7B-0ECl3PV-i7Tcg z0QJ%kqH5xYLdXPm2Rx3hfCS_AhsmygaMr}2V+v5TzO9W&zjyV3p{I6BlXk7y7)0}& zznZ_!l#%zQ_3TcduWqj>R2W&Oke)r0Y(Sl2*1?CvC?$-*7Rn6P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X;K-;QQEcgOKVpiecj5l%n9JXc@T*i?OGTM?w2P#axO- z&B=n-CBDDXAOG6E)tkN<>96fe@_HBbUjxk>7nlEwGp~UE$Ci^krM&qH=o8s4i7f#S zc!uUGLW)5W*KhOMcHfWrQ@->!Q20hI`=<#VXP=tIVoaBPie4G_+nf?fkTG;L$i6}? zI;%6i(3@m;S=RaD2!E}+mj7g-C%H{;*&P~kMB2#U?L(f{_ZIc5==gB|=Mb(aP{>6E zfsIy9(xGgnzYUf;KKJTk%e2eEl>!3top+vz+c)xd_^Ku+=V9p~sf2Z|+Ad|kv&vNu zNJgnWwWXP6QeYoSbo(*CeY3bv_oJix>GWa-$dOC8ue^wKAM0njsY|+GS*5P6P7CPHvGcKbwN@?QD3loRoyXG-#$lkt=nmM{r-^&&0UWKhbut z*7=!IolY?}Pdz)2LSI-m^ESS>Gck(wtwL_@t`v?+X5X z5yn3Se><1IddR;l$@o?9--+q}DmebiWBUKo)PL3UD_i+bO)syjxqjg;|0?_|gY{2g z+E-5NtMFg=tiNjbm3sE4hK5(}^gmwz-x1M%Rro8D>raJEzfJEr{K4q@7hcz|3VxkX z|5Je@&L3s^uj%z)MSq<{`ct%-@YllpIi>WgmVfVy{iy>0Xkr2Y{?ar1Rs7cs`lkXx x*58fzC4c^HKK)hczlZHVRRREn?EhlZKZ3Zb0@N!80RY6;AN4DY_c(vM`hQ=4.0.0", @@ -57,12 +60,16 @@ dev = [ "ruff", ] + [tool.pytest.ini_options] markers = [ - "fun: marks tests as functional (deselect with '-m \"not fun\"')", + "functional: marks tests as functional (deselect with '-m \"not functional\"')", ] addopts = [ "--strict-markers", + "--strict-config", + "--showlocals", + "-ra", ] diff --git a/superx_budget/__init__.py b/superx_budget/__init__.py index 60286b5..7f16735 100644 --- a/superx_budget/__init__.py +++ b/superx_budget/__init__.py @@ -5,6 +5,11 @@ Creating a budget overview from a SuperX export __version__ = "0.0.1" +import argparse +import pathlib +import sys +import warnings + from .budget import parse_budget_file # noqa: F401 from .exceptions import BudgetParserError, SuperXParserError # noqa: F401 from .helpers import ( # noqa: F401 @@ -17,3 +22,46 @@ from .helpers import ( # noqa: F401 from .overview import create_overview # noqa: F401 from .pyramid import main # noqa: F401 from .superx import parse_exported_file # noqa: F401 + + +def cli_parse_exported_file(): + parser = argparse.ArgumentParser( + prog="SuperxParserTest", + description="Try to parse a file exported from SuperX", + ) + parser.add_argument("filename") + args = parser.parse_args() + + with warnings.catch_warnings(action="ignore"): + sys.stderr.write(f"trying to read '{args.filename}'\n") + exported = superx.parse_exported_file(pathlib.Path(args.filename)) + sys.stderr.write("... OK\n") + + sys.stderr.write(f"searching budget file for year '{exported.account_year}'\n") + budget_dir = pathlib.Path(__file__).parent.parent / "budgets" + budget_file = find_budget_file( + budget_dir, exported.account_year + ) + if not budget_file: + sys.exit("... no budget file found") + sys.stderr.write(f"... found '{budget_file}'\n") + + sys.stderr.write(f"parsing budget file '{budget_file}'\n") + budget_data = parse_budget_file(budget_file) + sys.stderr.write("... OK\n") + + sys.stderr.write(f"Creating overview\n") + overview_map = create_overview(budget_data, exported) + sys.stderr.write("... OK\n") + + sys.stderr.write(f"Sorting overview\n") + overview = sorted(overview_map.values(), key=lambda i: i.row) + sys.stderr.write("... OK\n") + + sys.stderr.write(f"Geting recipients file\n") + recipients = find_recipients(budget_dir) + sys.stderr.write("... OK\n") + + sys.stderr.write(f"Retrieving sheet for export\n") + sheet = get_sheet_of_file(budget_file) + sys.stderr.write("... OK\n") \ No newline at end of file