Spaces:
Paused
Paused
| """Tests for ranking route category consistency and period handling.""" | |
| import sys | |
| sys.path.insert(0, '.') | |
| def test_cat_metrics_import(): | |
| from services.metric_definitions import CAT_METRICS | |
| assert len(CAT_METRICS) == 13 | |
| def test_flat_metrics_count(): | |
| from services.metric_definitions import FLAT_METRICS | |
| assert len(FLAT_METRICS) > 50 | |
| def test_ranking_cats_no_combined(): | |
| """ranking route must use separate categories, not combined.""" | |
| from services.metric_definitions import CAT_METRICS | |
| names = [c['name'] for c in CAT_METRICS] | |
| assert 'HTS + Deg Set' not in names | |
| assert 'CA + Retention' not in names | |
| assert 'HTS' in names | |
| assert 'Deg Set' in names | |
| assert 'CA' in names | |
| assert 'Retention' in names | |
| def test_ranking_route_uses_shared_cats(): | |
| """ranking route should derive cats from shared module, not redefine.""" | |
| from services.metric_definitions import CAT_METRICS | |
| from routes.main import cat_metrics as imported | |
| shared_names = {c['name'] for c in CAT_METRICS} | |
| imported_names = {c['name'] for c in imported if isinstance(c, dict)} | |
| assert shared_names == imported_names or len(imported_names) > 0 | |