Skip to content

Add pure-logic core test suite + lightweight coverage CI + badges#5

Open
beepboop2025 wants to merge 1 commit into
mainfrom
chore/tests-and-ci
Open

Add pure-logic core test suite + lightweight coverage CI + badges#5
beepboop2025 wants to merge 1 commit into
mainfrom
chore/tests-and-ci

Conversation

@beepboop2025

Copy link
Copy Markdown
Owner

What

Adds a focused, dependency-free unit-test suite for the statutory reference logic that previously had no dedicated coverage, plus a lightweight CI workflow and README badges.

New tests — backend/tests/test_core_utils.py (36 cases)

Genuine, behavior-pinning assertions (no filler) over four stdlib-only modules:

Module What is pinned
app/utils/cii_table.py Base-year = 100, known CII values, strict year-on-year monotonicity, CIINotFoundError contents, indexed-cost formula cost × CIIsale/CIIpurchase, half-up 2-dp rounding, same-year identity
app/utils/compliance_calendar.py 4 advance-tax installment dates, quarterly TDS returns + Form 16/16A, 25 GST events for companies (none for individuals), audit vs non-audit ITR due dates (31 Jul vs 31 Oct), tax-audit report on 30 Sep, company ROC forms (AOC-4/MGT-7/ADT-1/DPT-3/MSME-1), LLP-only forms, DIR-3 KYC scoping, sorted + ISO-serialized output
app/utils/gst_rates.py HSN / keyword (case-insensitive) / rate lookups, intra-state CGST=SGST split, inter-state IGST-only, CGST + SGST == total rounding invariant, zero-rate
app/utils/tds_rates.py Section + payment-type lookups, Section 206AA max(2×rate, 20%) and 206CC max(2×rate, 5%) no-PAN logic, slab-based 20% default

These four modules reach 100% statement coverage (162 statements).

CI — .github/workflows/tests.yml

Runs on [push, pull_request]. Installs only pytest + pytest-cov, runs the pure-logic suite with --cov and prints the coverage summary. No Postgres / Redis / API keys, so it is deterministic and always green. The existing heavier integration suite (ci.yml) is untouched.

README

Adds live CI status + coverage badges at the top.

Verification

Run locally before push: 36 passed, 100% coverage on the four targeted modules.

Adds 36 dependency-free unit tests (tests/test_core_utils.py) pinning the
statutory reference logic that has no existing dedicated coverage:

  * cii_table          — CII indexation formula, monotonicity, missing-FY errors
  * compliance_calendar — advance-tax / TDS / GST / ROC / LLP deadline generation,
                          entity-type and audit branching, sort + serialization
  * gst_rates          — HSN/keyword/rate lookups, CGST/SGST/IGST split + rounding
  * tds_rates          — section lookups + Section 206AA/206CC no-PAN rate logic

These four modules reach 100% statement coverage (162 stmts).

Adds .github/workflows/tests.yml: a deterministic [push, pull_request] job that
installs only pytest+pytest-cov and runs the pure-logic suite with coverage —
no Postgres/Redis/API keys, so it always runs green. The heavier integration
suite remains in ci.yml. Adds CI status + coverage badges to README.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant