fix(tests): test_form2_ahr_limit падает KeyError после null-strip (AURORA-1897, часть #296) #299

Merged
aep merged 1 commits from feat/296-ahr-limit-tests-null-strip into test 2026-11-08 17:10:07 +03:00
Showing only changes of commit 8ba26427dd - Show all commits

View File

@ -104,7 +104,7 @@ def test_annual_dms_limit_divided_by_four(client, admin_tokens, form2_id):
# лимитные LEAF из сидовых данных).
before = _find_ahr_header_row(
_get_sheet_rows(client, admin_tokens, form2_id, "AHR"), 456
)["data"]["plan"]["q1"] or 0
)["data"]["plan"].get("q1") or 0
rows = _patch_cell(client, admin_tokens, form2_id, "AHR_LIMIT", 24, "qty_q1", 10)
row = _find_by_id(rows, 24)
@ -113,7 +113,7 @@ def test_annual_dms_limit_divided_by_four(client, admin_tokens, form2_id):
after = _find_ahr_header_row(
_get_sheet_rows(client, admin_tokens, form2_id, "AHR"), 456
)["data"]["plan"]["q1"] or 0
)["data"]["plan"].get("q1") or 0
assert (after - before) == pytest.approx(69.645)
@ -124,7 +124,7 @@ def test_quarterly_limit_uses_amount_without_vat(client, admin_tokens, form2_id)
# статьи — см. комментарий в test_annual_dms_limit_divided_by_four.
before = _find_ahr_header_row(
_get_sheet_rows(client, admin_tokens, form2_id, "AHR"), 150
)["data"]["plan"]["q2"] or 0
)["data"]["plan"].get("q2") or 0
rows = _patch_cell(client, admin_tokens, form2_id, "AHR_LIMIT", 3, "qty_q2", 1)
row = _find_by_id(rows, 3)
@ -132,7 +132,7 @@ def test_quarterly_limit_uses_amount_without_vat(client, admin_tokens, form2_id)
after = _find_ahr_header_row(
_get_sheet_rows(client, admin_tokens, form2_id, "AHR"), 150
)["data"]["plan"]["q2"] or 0
)["data"]["plan"].get("q2") or 0
assert (after - before) == pytest.approx(2.0)
@ -144,7 +144,7 @@ def test_sim_card_without_vat_limit_backfilled_is_not_zero(client, admin_tokens,
# статьи — см. комментарий в test_annual_dms_limit_divided_by_four.
before = _find_ahr_header_row(
_get_sheet_rows(client, admin_tokens, form2_id, "AHR"), 150
)["data"]["plan"]["q1"] or 0
)["data"]["plan"].get("q1") or 0
rows = _patch_cell(client, admin_tokens, form2_id, "AHR_LIMIT", 7, "qty_q1", 20)
row = _find_by_id(rows, 7)
@ -152,7 +152,7 @@ def test_sim_card_without_vat_limit_backfilled_is_not_zero(client, admin_tokens,
after = _find_ahr_header_row(
_get_sheet_rows(client, admin_tokens, form2_id, "AHR"), 150
)["data"]["plan"]["q1"] or 0
)["data"]["plan"].get("q1") or 0
assert (after - before) == pytest.approx(7.5)
@ -165,7 +165,7 @@ def test_printers_annual_limit_without_name_lookup(client, admin_tokens, form2_i
# комментарий в test_annual_dms_limit_divided_by_four.
before = _find_ahr_header_row(
_get_sheet_rows(client, admin_tokens, form2_id, "AHR"), 167
)["data"]["plan"]["q1"] or 0
)["data"]["plan"].get("q1") or 0
rows = _patch_cell(client, admin_tokens, form2_id, "AHR_LIMIT", 13, "qty_q1", 5)
row = _find_by_id(rows, 13)
@ -173,7 +173,7 @@ def test_printers_annual_limit_without_name_lookup(client, admin_tokens, form2_i
after = _find_ahr_header_row(
_get_sheet_rows(client, admin_tokens, form2_id, "AHR"), 167
)["data"]["plan"]["q1"] or 0
)["data"]["plan"].get("q1") or 0
assert (after - before) == pytest.approx(6.471875)
@ -185,7 +185,7 @@ def test_quarterly_norm_unchanged_other_than_vat_source(client, admin_tokens, fo
# статьи — см. комментарий в test_annual_dms_limit_divided_by_four.
before = _find_ahr_header_row(
_get_sheet_rows(client, admin_tokens, form2_id, "AHR"), 179
)["data"]["plan"]["q3"] or 0
)["data"]["plan"].get("q3") or 0
rows = _patch_cell(client, admin_tokens, form2_id, "AHR_LIMIT", 17, "qty_q3", 2)
row = _find_by_id(rows, 17)
@ -193,7 +193,7 @@ def test_quarterly_norm_unchanged_other_than_vat_source(client, admin_tokens, fo
after = _find_ahr_header_row(
_get_sheet_rows(client, admin_tokens, form2_id, "AHR"), 179
)["data"]["plan"]["q3"] or 0
)["data"]["plan"].get("q3") or 0
assert (after - before) == pytest.approx(7.5)
@ -232,7 +232,7 @@ def test_rent_plan_still_passed_through_without_division(client, admin_tokens, f
# быть другие записи аренды из сидовых данных).
before = _find_ahr_header_row(
_get_sheet_rows(client, admin_tokens, form2_id, "AHR"), AHR_RENT_PARENT_EXPENSE_ITEM
)["data"]["plan"]["q1"] or 0
)["data"]["plan"].get("q1") or 0
response = client.post(
f"/api/v1/form/{form2_id}/sheet/AHR_RENT/line",
@ -253,5 +253,5 @@ def test_rent_plan_still_passed_through_without_division(client, admin_tokens, f
after = _find_ahr_header_row(
_get_sheet_rows(client, admin_tokens, form2_id, "AHR"), AHR_RENT_PARENT_EXPENSE_ITEM
)["data"]["plan"]["q1"] or 0
)["data"]["plan"].get("q1") or 0
assert (after - before) == 100