fix: add us-cpa tax year rules and package metadata

This commit is contained in:
Stefano Fiorini
2026-03-15 02:47:14 -05:00
parent d3fd874330
commit 6c02e0b7c6
9 changed files with 211 additions and 45 deletions

View File

@@ -13,15 +13,33 @@ SKILL_DIR = Path(__file__).resolve().parents[1]
SRC_DIR = SKILL_DIR / "src"
def _pyproject_text() -> str:
return (SKILL_DIR / "pyproject.toml").read_text()
class UsCpaCliSmokeTests(unittest.TestCase):
def test_skill_scaffold_files_exist(self) -> None:
self.assertTrue((SKILL_DIR / "SKILL.md").exists())
self.assertTrue((SKILL_DIR / "pyproject.toml").exists())
self.assertTrue((SKILL_DIR / "README.md").exists())
self.assertTrue((SKILL_DIR / "scripts" / "us-cpa").exists())
self.assertTrue(
(SKILL_DIR.parent.parent / "docs" / "us-cpa.md").exists()
)
def test_pyproject_declares_runtime_and_dev_dependencies(self) -> None:
pyproject = _pyproject_text()
self.assertIn('"pypdf>=', pyproject)
self.assertIn('"reportlab>=', pyproject)
self.assertIn("[project.optional-dependencies]", pyproject)
self.assertIn('"pytest>=', pyproject)
def test_readme_documents_install_and_script_usage(self) -> None:
readme = (SKILL_DIR / "README.md").read_text()
self.assertIn("pip install -e .[dev]", readme)
self.assertIn("scripts/us-cpa", readme)
self.assertIn("python -m unittest", readme)
def test_fixture_directories_exist(self) -> None:
fixtures_dir = SKILL_DIR / "tests" / "fixtures"
for name in ("irs", "facts", "documents", "returns"):

View File

@@ -33,6 +33,7 @@ class QuestionEngineTests(unittest.TestCase):
self.assertEqual(analysis["taxYear"], 2025)
self.assertEqual(analysis["conclusion"]["answer"], "$15,750")
self.assertEqual(analysis["confidence"], "high")
self.assertEqual(analysis["riskLevel"], "low")
self.assertTrue(analysis["authorities"])
self.assertEqual(analysis["authorities"][0]["sourceClass"], "irs_instructions")
@@ -47,6 +48,7 @@ class QuestionEngineTests(unittest.TestCase):
)
self.assertEqual(analysis["confidence"], "low")
self.assertEqual(analysis["riskLevel"], "high")
self.assertTrue(analysis["primaryLawRequired"])
self.assertIn("Internal Revenue Code", analysis["missingFacts"][0])
@@ -59,6 +61,7 @@ class QuestionEngineTests(unittest.TestCase):
"authorities": [{"title": "Instructions for Form 1040 and Schedules 1-3"}],
"conclusion": {"answer": "$15,750", "summary": "Single filers use a $15,750 standard deduction for tax year 2025."},
"confidence": "high",
"riskLevel": "low",
"followUpQuestions": [],
"primaryLawRequired": False,
}

View File

@@ -43,6 +43,13 @@ class ReturnModelTests(unittest.TestCase):
def test_tax_bracket_calculation_uses_2025_single_rates(self) -> None:
self.assertEqual(tax_on_ordinary_income(34350.0, "single"), 3883.5)
def test_tax_bracket_calculation_uses_selected_tax_year(self) -> None:
self.assertEqual(tax_on_ordinary_income(33650.0, "single", 2024), 3806.0)
def test_normalize_case_facts_rejects_unsupported_tax_year(self) -> None:
with self.assertRaisesRegex(ValueError, "Unsupported tax year"):
normalize_case_facts({"filingStatus": "single"}, 2023)
if __name__ == "__main__":
unittest.main()