typosaurus a80acb36c3 test(sveta): Write tests for median function
Outcome: done

Changed: tests/test_calculator.py:3, tests/test_calculator.py:68-90

Verified by: make verify — exit code 0, 22 tests passed, verification passed.

Findings:
- tests/test_calculator.py:3 — `median` imported alongside `clamp`.
- tests/test_calculator.py:68-90 — `TestMedianFunction` class added with 6 tests: odd-length returns middle element, even-length returns float average, single-element returns that element, empty list raises ValueError, unsorted odd-length sorts correctly, unsorted even-length sorts and returns float average.
- All 6 acceptance criteria addressed: odd-length, even-length (float), single-element, empty (ValueError), unsorted sorting, and existing conventions (retoor header, unittest.TestCase, full type annotations).

Open: none

Confidence: high — verification passed with all 22 tests, coverage confirmed against every acceptance criterion.

Typosaurus-Run: 529efb295dd94e799a5e47a9ef0c6c16
Typosaurus-Node: 341a13e1a6b04e838cc1ff6d643aab85
Typosaurus-Agent: @sveta
Refs: #13
2026-07-26 20:10:57 +00:00
2026-07-26 16:09:21 +02:00

retoor retoor@molodetz.nl

typosaurus-sandbox

Sandbox for Typosaurus end-to-end verification.

A FastAPI application serving arithmetic operations over HTTP with JSON request/response bodies.

Configuration

The application uses a single .env.json file at the project root as its central point of truth for configuration. Defaults are plug-and-play and require no setup:

{
    "host": "127.0.0.1",
    "port": 8000
}

When no .env.json is present, the application starts with these defaults. To customise, create .env.json in the project root and populate only the keys that differ.

Usage

Start the server

python -m typosaurus_sandbox

The server listens on http://127.0.0.1:8000 by default.

Health check

GET /health

Response:

{"status": "ok"}

API endpoints

All calculator endpoints accept POST requests with a JSON body and return a JSON response.

POST /api/v1/calculator/add

Add two integers.

Request:

{"left": 3, "right": 5}

Response:

{"result": 8}

POST /api/v1/calculator/subtract

Subtract the right integer from the left.

Request:

{"left": 10, "right": 3}

Response:

{"result": 7}

POST /api/v1/calculator/clamp

Clamp a value between a low and high bound.

Request:

{"value": 15, "low": 0, "high": 10}

Response:

{"result": 10}

Boundaries are inclusive. A low > high combination produces a 422 validation response.

POST /api/v1/calculator/clamp-to-byte

Clamp an integer to the byte range [0, 255].

Request:

{"value": 300}

Response:

{"result": 255}

Verification

make verify

Runs compile-all checks against all source and test files, then executes the full test suite. Zero warnings are tolerated.

S
Description
Sandbox for Typosaurus end-to-end verification
Readme
236 KiB
Languages
Python 92%
HTML 7.3%
Makefile 0.7%