test: add us-cpa module coverage and citations

This commit is contained in:
Stefano Fiorini
2026-03-15 03:11:24 -05:00
parent fb39fe76cb
commit 1be0317192
5 changed files with 123 additions and 0 deletions

View File

@@ -36,10 +36,30 @@ def _facts_from_text(text: str) -> dict[str, Any]:
extracted["wages"] = _parse_number(match.group(1))
if match := re.search(r"Box 2 Federal income tax withheld\s+" + _NUMBER, text, re.I):
extracted["federalWithholding"] = _parse_number(match.group(1))
if match := re.search(r"Box 16 State wages, tips, etc\.\s+" + _NUMBER, text, re.I):
extracted["stateWages"] = _parse_number(match.group(1))
if match := re.search(r"Box 17 State income tax\s+" + _NUMBER, text, re.I):
extracted["stateWithholding"] = _parse_number(match.group(1))
if match := re.search(r"Box 3 Social security wages\s+" + _NUMBER, text, re.I):
extracted["socialSecurityWages"] = _parse_number(match.group(1))
if match := re.search(r"Box 5 Medicare wages and tips\s+" + _NUMBER, text, re.I):
extracted["medicareWages"] = _parse_number(match.group(1))
if match := re.search(r"Box 1 Interest Income\s+" + _NUMBER, text, re.I):
extracted["taxableInterest"] = _parse_number(match.group(1))
if match := re.search(r"Box 1a Total ordinary dividends\s+" + _NUMBER, text, re.I):
extracted["ordinaryDividends"] = _parse_number(match.group(1))
if match := re.search(r"Box 1 Gross distribution\s+" + _NUMBER, text, re.I):
extracted["retirementDistribution"] = _parse_number(match.group(1))
if match := re.search(r"Box 3 Other income\s+" + _NUMBER, text, re.I):
extracted["otherIncome"] = _parse_number(match.group(1))
if match := re.search(r"Net profit(?: or loss)?\s+" + _NUMBER, text, re.I):
extracted["businessIncome"] = _parse_number(match.group(1))
if match := re.search(r"Adjusted gross income\s+" + _NUMBER, text, re.I):
extracted["priorYear.adjustedGrossIncome"] = _parse_number(match.group(1))
if match := re.search(r"Taxable income\s+" + _NUMBER, text, re.I):
extracted["priorYear.taxableIncome"] = _parse_number(match.group(1))
if match := re.search(r"Refund\s+" + _NUMBER, text, re.I):
extracted["priorYear.refund"] = _parse_number(match.group(1))
return extracted