uv sync
uv run python -m unittest discover -s tests -vThe test suite uses the Python standard library unittest module. No pytest
dependency is required.
| File | Scope |
|---|---|
tests/test_client.py |
Client routing, id parsing, JSON handling |
tests/test_search.py |
Search payload construction and validation |
tests/test_autocomplete.py |
Location autocomplete payloads and parser behavior |
tests/test_models.py |
Dataclass model behavior |
tests/test_enrichment_parser.py |
Auxiliary endpoint parser normalization |
tests/test_transport_parallel.py |
Retry rotation, headers, parallel runner |
tests/test_live.py |
Gated live Funda smoke tests |
Fast local tests:
uv run python -m unittest discover -s testsLive tests:
PYFUNDA_LIVE=1 uv run python -m unittest tests.test_live -vLive tests verify listing, search, parallel fetching, and enrichment endpoints. They intentionally stay narrow. Do not add broad city sweeps or large parallel batches to the default live checks.
Before committing production changes:
uv run python -m py_compile funda/*.py examples/*.py tests/*.py
uv run python -m unittest discover -s tests -v
PYFUNDA_LIVE=1 uv run python -m unittest tests.test_live -vFor docs and notebooks:
uv run python -m json.tool examples/analysis.ipynb >/dev/null
uv run python examples/full_api_walkthrough.py- Public API methods should be short, direct, and named like Python methods:
listing,search,price_history,broker_info. - Private implementation details stay underscore-prefixed.
- Prefer typed dataclasses for stable user-facing models.
- Preserve raw response data on models with a
rawfield. - Use parser modules for payload normalization; do not parse API payloads in
Fundamethods. - Use
_get_json()for simple GET endpoints with repeated status handling. - Keep network tests opt-in with
PYFUNDA_LIVE=1.
The transport chooses a fingerprint lazily, caches the last working fingerprint
class-wide, and rotates on retryable statuses (403, 429, 503). It does not
preflight a separate test URL before real requests.
Batch APIs use a reusable private _ParallelRunner. Single listing and single
search calls remain sequential.