From 478b04e423aeab36b5431c3b25f1f0e605528580 Mon Sep 17 00:00:00 2001 From: yewentao256 Date: Thu, 16 Oct 2025 22:02:19 +0000 Subject: [PATCH] update through comments Signed-off-by: yewentao256 --- tests/v1/generation/test_batch_invariance.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/v1/generation/test_batch_invariance.py b/tests/v1/generation/test_batch_invariance.py index d4dc6b4e221fc..da86a9b0da40a 100644 --- a/tests/v1/generation/test_batch_invariance.py +++ b/tests/v1/generation/test_batch_invariance.py @@ -59,12 +59,15 @@ def _random_prompt(min_words: int = 1024, max_words: int = 1024 * 2) -> str: # Pick a random template base_prompt = random.choice(prompt_templates) - # Add some padding to vary the length if needed - if min_words > 50: + if max_words < min_words: + max_words = min_words + target_words = random.randint(min_words, max_words) + + if target_words > 50: # For longer prompts, repeat context padding_text = ( " This is an interesting topic that deserves more explanation. " - * (min_words // 50) + * (target_words // 50) ) base_prompt = base_prompt + padding_text