test: add unit tests for BedrockClassifier#457
Conversation
Adds comprehensive unit tests for BedrockClassifier covering initialization, tool schema generation, classification flow, error handling, and callbacks.
|
@claude review this |
|
Claude finished @brnaba-aws's task in 1m 58s —— View job PR Review: test: add unit tests for BedrockClassifier
Overall this is a solid addition — the test structure mirrors Critical: Decorator ordering on all async testsEvery async test uses this ordering: @patch('agent_squad.classifiers.bedrock_classifier.user_agent')
@pytest.mark.asyncio
async def test_process_request_success(self, mock_user_agent):Python decorators are applied bottom-up, so here The conventional and safe order is: @pytest.mark.asyncio
@patch('agent_squad.classifiers.bedrock_classifier.user_agent')
async def test_process_request_success(self, mock_user_agent):This applies to all 12 async tests (lines 181, 221, 235, 258, 288, 313, 325, 344, 392, 426, 460, 496, 534). Fix this → Missing test:
|
|
Hey @hashwnath, is the default classifier and had no unit tests, so filling this gap is genuinely valuable. The tests follow existing patterns and cover the key scenarios well. Only thing needed before merging: CI has not run yet — needs to go green first. |
- move @pytest.mark.asyncio above @patch decorators so the async mark propagates correctly through the patch wrappers - add test for mistral-large toolChoice branch - drop unused MagicMock import
|
Hi, Addressed the previous comments, hope CI runs this time. It might need a manual approval from your end since it's my first PR here. |
Addresses #448
Adds comprehensive unit tests for
BedrockClassifiercovering:analyzePrompttool spec shape and required fieldstoolChoicebehavior for anthropic vs non-anthropic models, custom inference config propagationBotoCoreError,ClientErroron_classifier_startandon_classifier_stopare invoked with correct argumentsFollows existing test patterns from
test_anthropic_classifier.py(pytest, MockAgent,@patch,@pytest.mark.asyncio).All 22 tests pass.