Skip to content

Commit 8bc0b94

Browse files
committed
test : more robust check
output messages may be different
1 parent 2c5aa80 commit 8bc0b94

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/test_llm_client.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,13 @@ def test_call_api_rate_limit_success(mock_post: Mock, client: LLMAPIClient, samp
9999
result = client.call_api(sample_question)
100100
assert result == "4"
101101
assert mock_post.call_count == 2 # Initial + 1 retry
102-
client.logger.warning.assert_called_once_with(
103-
"Rate limit hit. Retrying in 0.1s (attempt 1/2)"
104-
)
102+
103+
# Robust check: ensure called once, then verify key parts
104+
client.logger.warning.assert_called_once()
105+
log_msg = client.logger.warning.call_args[0][0]
106+
assert "Rate limit (429) hit" in log_msg
107+
assert "Retrying in 0.1s" in log_msg # Delay is dynamic but fixed in this test (attempt 0 -> 0.1s)
108+
assert "(attempt 1/2)" in log_msg
105109

106110

107111
@patch("llm_client.time.sleep")

0 commit comments

Comments
 (0)