Skip to content

Add unit tests - #7

Merged
dariomory merged 3 commits into
dariomory:masterfrom
TisaneFruitRouge:feat/add-unit-tests
Apr 18, 2026
Merged

Add unit tests#7
dariomory merged 3 commits into
dariomory:masterfrom
TisaneFruitRouge:feat/add-unit-tests

Conversation

@TisaneFruitRouge

Copy link
Copy Markdown
Contributor

What

Adds a comprehensive unit test suite (267 tests across 9 files) covering enums, models, parsers, exporters, exceptions, transport, session, and fetcher layers. Also fixes a bug in _normalize_timeout
where httpx.Timeout(connect=a, read=b) raised a ValueError on httpx 0.28 — the call now passes a positional default: httpx.Timeout(b, connect=a, read=b).

AI Provenance

  • Tool: Claude Code
  • Model: Claude Opus 4.7
  • Prompt/thread: The session began with a security audit of the repository before any code was written. Once the codebase was cleared as safe, dependencies were installed and the user requested thorough
    test coverage. The model first performed a full codebase exploration — reading every source file under src/trendflow/, mapping all classes, methods, return types, exception paths, and mock boundaries —
    before writing a single test. Tests were then written bottom-up (pure helpers first, then models, parsers, exporters, exceptions, transport, session, fetcher, and public API), with shared fixtures
    extracted into conftest.py. After the first full run, two categories of failures emerged: a missing RegionalInterestRow export from the package root (fixed in the test import), and a real source-level
    incompatibility in _normalize_timeout with httpx 0.28. The bug was diagnosed from the traceback, confirmed against the httpx API, and patched in the source. All 267 tests pass on Python 3.14.

Checklist

[X] Addresses exactly one issue or feature
[X] New or changed behavior has test coverage
[X] Diff contains only changes for this task

@TisaneFruitRouge

Copy link
Copy Markdown
Contributor Author

Run the tests using uv run pytest

@dariomory

Copy link
Copy Markdown
Owner

@TisaneFruitRouge can you check the CI?

@TisaneFruitRouge

Copy link
Copy Markdown
Contributor Author

@TisaneFruitRouge can you check the CI?

Sure

@dariomory
dariomory merged commit 4bd4684 into dariomory:master Apr 18, 2026
10 checks passed
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.

2 participants