Spaces:
Build error
Build error
| # tests/test_validators.py — minimal unit tests for validator logic | |
| import numpy as np | |
| # Synthetic totals for monotonicity | |
| worst_ebitda = 100 | |
| base_ebitda = 150 | |
| best_ebitda = 200 | |
| worst_cash = 80 | |
| base_cash = 120 | |
| best_cash = 160 | |
| assert worst_ebitda <= base_ebitda <= best_ebitda, "EBITDA monotonicity failed" | |
| assert worst_cash <= base_cash <= best_cash, "Cash monotonicity failed" | |
| # Bounds example | |
| bounds = { | |
| "rev_growth_pct": (-0.20, 0.30), | |
| "gm_bps": (-500, 500), | |
| "opex_infl_pct": (-0.10, 0.20), | |
| "fx_pct": (-0.10, 0.10), | |
| "dso": (30, 90), | |
| "dpo": (15, 90), | |
| "dio": (20, 120), | |
| } | |
| sample_drivers = {"rev_growth_pct": 0.05, "gm_bps": 100, "opex_infl_pct": 0.02, "fx_pct": 0.00, "dso": 60, "dpo": 45, "dio": 60} | |
| for k,(lo,hi) in bounds.items(): | |
| v = sample_drivers[k] | |
| assert lo <= v <= hi, f"{k} out of bounds" | |
| print("Validator smoke tests passed.") | |