User Story
As a software engineer,
I want MagicMock instances in test_eknowledge.py to enforce API contracts via spec=True
so that unintended method calls or attribute accesses during testing raise immediate errors.
Background
Current MagicMock calls in TestExecuteGraphGeneration (e.g., self.mock_llm = MagicMock()) lack specification binding. This allows:
- Calls to non-existent methods on the mocked
ChatLLM7 class
- Silent failures when API contracts change
- False test passes due to overly permissive mocks
Specific risk areas include tests like test_single_chunk_success and test_llm_returns_malformed_node, where loose mocks in tests/test_eknowledge.py could mask interface mismatches with the real ChatLLM7 implementation.
Acceptance Criteria
User Story
As a software engineer,
I want MagicMock instances in
test_eknowledge.pyto enforce API contracts viaspec=Trueso that unintended method calls or attribute accesses during testing raise immediate errors.
Background
Current MagicMock calls in
TestExecuteGraphGeneration(e.g.,self.mock_llm = MagicMock()) lack specification binding. This allows:ChatLLM7classSpecific risk areas include tests like
test_single_chunk_successandtest_llm_returns_malformed_node, where loose mocks intests/test_eknowledge.pycould mask interface mismatches with the realChatLLM7implementation.Acceptance Criteria
TestExecuteGraphGenerationclass:spec=Trueto MagicMock calls in test methods liketest_llm_returns_no_nodesandtest_llm_invocation_error_then_successself.mock_llm.nonexistent_method())