fix: extract_gemini_web_search_count#418
Open
zachary822 wants to merge 1 commit intoPostHog:masterfrom
Open
Conversation
Comment on lines
+1166
to
+1169
| def test_none_candidates_no_web_search(mock_client, mock_google_genai_client): | ||
| """Test that response with candidates=None does not crash web search extraction.""" | ||
|
|
||
| mock_response = MagicMock() |
Contributor
There was a problem hiding this comment.
[P3] Prefer parameterizing the web-search “no candidates” cases
This new test covers candidates=None, but it duplicates the structure of the existing “no web search” tests nearby; given the repo preference for parameterized tests, it’d be simpler to combine the “no candidates” variants (e.g. candidates=None and candidates=[]) into one @pytest.mark.parametrize case table so new edge cases don’t keep adding near-identical blocks.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: posthog/test/ai/gemini/test_gemini.py
Line: 1166:1169
Comment:
[P3] Prefer parameterizing the web-search “no candidates” cases
This new test covers `candidates=None`, but it duplicates the structure of the existing “no web search” tests nearby; given the repo preference for parameterized tests, it’d be simpler to combine the “no candidates” variants (e.g. `candidates=None` and `candidates=[]`) into one `@pytest.mark.parametrize` case table so new edge cases don’t keep adding near-identical blocks.
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
extract_gemini_web_search_counterrors ifresponse.candidatesis None