test(synth): add unit tests for is_positive_outcome#40
Merged
Conversation
is_positive_outcome had no direct tests; it was only exercised through the full outcome-pipeline e2e test. The new tests cover the four boundary conditions: empty list, single-event positive, activity-not-last, and ordinary negative. A probabilistic rate test verifies that the synthetic log produces roughly the 10% positive share dictated by PATHS/WEIGHTS for large n_cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
is_positive_outcomeinpm_bench/_synth.pyis the ground-truth rule for the synthetic-toy outcome task (a case is positive iff it ends withdelivery_confirmed). It had zero direct unit tests: the only coverage came from the full outcome-pipeline e2e test, which uses a different_is_paystub and would not catch a regression in the actualdelivery_confirmedcheck.This closes that gap without touching any production code.
What
tests/test_synth.pydelivery_confirmednot in last position (False), typical three-event positive (True)synthetic_log(n_cases=500, seed=42)must produce a positive rate in[0.05, 0.20], consistent withWEIGHTS[4] = 0.10Tests
pytest tests/test_synth.py- all 10 tests pass (4 existing + 6 new)ruff check tests/test_synth.py- cleanSelf-merge gate
Generated by Claude Code