fix: quant selector quality-order assertion (#139)
All checks were successful
Smoke Test / smoke (pull_request) Successful in 15s

This commit is contained in:
2026-04-21 11:25:20 +00:00
parent fc67bd7085
commit 93a27078aa

View File

@@ -20,9 +20,17 @@ from evolution.quant_selector import (
class TestQuantLevels:
def test_levels_ordered_by_quality(self):
"""Levels should be ordered from best quality to most aggressive."""
"""Levels should be ordered from highest quality (most bits) to most aggressive.
The selection logic iterates QUANT_LEVELS in order and picks the first
level that fits in available memory. So higher bits_per_channel (better
quality) must come first, regardless of whether it's TurboQuant or standard.
"""
for i in range(len(QUANT_LEVELS) - 1):
assert QUANT_LEVELS[i].bits_per_channel > QUANT_LEVELS[i + 1].bits_per_channel
assert QUANT_LEVELS[i].bits_per_channel > QUANT_LEVELS[i + 1].bits_per_channel, (
f"{QUANT_LEVELS[i].name} ({QUANT_LEVELS[i].bits_per_channel}b) should come "
f"before {QUANT_LEVELS[i+1].name} ({QUANT_LEVELS[i+1].bits_per_channel}b)"
)
def test_all_levels_have_required_fields(self):
for level in QUANT_LEVELS: