Skip to content

Conversation

@didier-durand
Copy link
Contributor

@didier-durand didier-durand commented Dec 14, 2025

Description

Adding 21 tests for client/card_resolver.py

They all pass:

========================= test session starts ==============================
collecting ... collected 21 items

tests/client/test_card_resolver.py::TestA2ACardResolverInit::test_init_with_defaults PASSED [  4%]
tests/client/test_card_resolver.py::TestA2ACardResolverInit::test_init_with_custom_path PASSED [  9%]
tests/client/test_card_resolver.py::TestA2ACardResolverInit::test_init_strips_leading_slash_from_agent_card_path PASSED [ 14%]
tests/client/test_card_resolver.py::TestGetAgentCard::test_get_agent_card_success_default_path PASSED [ 19%]
tests/client/test_card_resolver.py::TestGetAgentCard::test_get_agent_card_success_custom_path PASSED [ 23%]
tests/client/test_card_resolver.py::TestGetAgentCard::test_get_agent_card_strips_leading_slash_from_relative_path PASSED [ 28%]
tests/client/test_card_resolver.py::TestGetAgentCard::test_get_agent_card_with_http_kwargs PASSED [ 33%]
tests/client/test_card_resolver.py::TestGetAgentCard::test_get_agent_card_root_path PASSED [ 38%]
tests/client/test_card_resolver.py::TestGetAgentCard::test_get_agent_card_http_status_error PASSED [ 42%]
tests/client/test_card_resolver.py::TestGetAgentCard::test_get_agent_card_json_decode_error PASSED [ 47%]
tests/client/test_card_resolver.py::TestGetAgentCard::test_get_agent_card_request_error PASSED [ 52%]
tests/client/test_card_resolver.py::TestGetAgentCard::test_get_agent_card_validation_error PASSED [ 57%]
tests/client/test_card_resolver.py::TestGetAgentCard::test_get_agent_card_logs_success PASSED [ 61%]
tests/client/test_card_resolver.py::TestGetAgentCard::test_get_agent_card_none_relative_path PASSED [ 66%]
tests/client/test_card_resolver.py::TestGetAgentCard::test_get_agent_card_empty_string_relative_path PASSED [ 71%]
tests/client/test_card_resolver.py::TestGetAgentCard::test_get_agent_card_different_status_codes[400] PASSED [ 76%]
tests/client/test_card_resolver.py::TestGetAgentCard::test_get_agent_card_different_status_codes[401] PASSED [ 80%]
tests/client/test_card_resolver.py::TestGetAgentCard::test_get_agent_card_different_status_codes[403] PASSED [ 85%]
tests/client/test_card_resolver.py::TestGetAgentCard::test_get_agent_card_different_status_codes[500] PASSED [ 90%]
tests/client/test_card_resolver.py::TestGetAgentCard::test_get_agent_card_different_status_codes[502] PASSED [ 95%]
tests/client/test_card_resolver.py::TestGetAgentCard::test_get_agent_card_returns_agent_card_instance PASSED [100%]

======================== 21 passed, 2 warnings in 0.11s ========================

Fixes #<issue_number_goes_here> 🦕

N/A

@didier-durand didier-durand requested a review from a team as a code owner December 14, 2025 07:47
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @didier-durand, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the reliability and stability of the A2ACardResolver component by introducing a comprehensive suite of 17 new unit tests. These tests validate the resolver's initialization logic and its critical get_agent_card method across a wide array of scenarios, including successful data retrieval, various path configurations, and robust error handling for network, data parsing, and validation issues. The addition of these tests ensures that future changes to the A2ACardResolver maintain its expected behavior and resilience.

Highlights

  • New Test File Added: A new test file, tests/client/test_card_resolver.py, has been added to the project.
  • Comprehensive Test Coverage: This pull request introduces 17 new tests for the A2ACardResolver class, significantly improving its test coverage.
  • Initialization Tests: Tests cover various A2ACardResolver initialization scenarios, including default paths, custom paths, and handling of leading slashes in paths.
  • get_agent_card Method Tests: Extensive tests for the get_agent_card method ensure correct behavior for successful fetches, custom relative paths, root paths, and proper passing of http_kwargs.
  • Robust Error Handling: The new tests validate the get_agent_card method's error handling for HTTP status errors, JSON decoding errors, network request errors, and data validation failures.
  • Passing Tests: All 17 newly added tests are passing, as confirmed by the provided pytest output.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a comprehensive suite of 17 tests for the A2ACardResolver, significantly improving test coverage. The tests cover initialization, various fetch scenarios, and robust error handling. Overall, this is a great addition. I've provided a few suggestions to further enhance the tests by improving fixture data, adding a missing assertion, correcting a docstring, making a test more robust with proper mocking, and refactoring another to use pytest.mark.parametrize for better readability and structure.

@didier-durand didier-durand changed the title test: adding 17 tests for client/card_resolver.py test: adding 21 tests for client/card_resolver.py Dec 14, 2025
@lkawka lkawka merged commit 3deecc4 into a2aproject:main Dec 16, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants