0
Generate high-value unit tests for existing untested code, not filler
Write unit tests for the function/class below in framework. I don't want boilerplate happy-path-only tests. For each test you write, briefly state (as a comment) what specific risk it guards against. Cover, in priority order:
1. Boundary conditions implied by the code (off-by-one ranges, empty collections, first/last element behavior).
2. Error paths: every raised exception or returned error should have at least one test that triggers it deliberately.
3. State mutation correctness if the function has side effects: assert the state after, not just the return value.
4. Any branch in the code that isn't exercised by the boundary/error tests above, so coverage isn't accidental.
5. Skip tests that would just restate the implementation (e.g. mocking every internal call so the test can't fail even if logic changes) - flag anywhere the code's structure makes it hard to test meaningfully without a refactor, instead of writing a fake test.
Code: code
Existing test file (if any, so I don't get duplicates): existing_tests