From 93a27078aa7abd601759a3b138eb737c6a855a0d Mon Sep 17 00:00:00 2001 From: Alexander Whitestone Date: Tue, 21 Apr 2026 11:25:20 +0000 Subject: [PATCH] fix: quant selector quality-order assertion (#139) --- tests/test_quant_selector.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/test_quant_selector.py b/tests/test_quant_selector.py index 5447d143..c54baf59 100644 --- a/tests/test_quant_selector.py +++ b/tests/test_quant_selector.py @@ -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: