MCPcopy Create free account
hub / github.com/grapeot/devin.cursorrules / test_search_error

Method test_search_error

tests/test_search_engine.py:85–96  ·  view source on GitHub ↗
(self, mock_ddgs)

Source from the content-addressed store, hash-verified

83
84 @patch('tools.search_engine.DDGS')
85 def test_search_error(self, mock_ddgs):
86 # Mock search error
87 mock_ddgs_instance = MagicMock()
88 mock_ddgs_instance.__enter__.return_value.text.side_effect = Exception("Test error")
89 mock_ddgs.return_value = mock_ddgs_instance
90
91 # Run search and check for error
92 with self.assertRaises(SystemExit) as cm:
93 search("test query")
94
95 self.assertEqual(cm.exception.code, 1)
96 self.assertIn("ERROR: Search failed: Test error", self.stderr.getvalue())
97
98 def test_result_field_fallbacks(self):
99 # Test that the fields work correctly with N/A fallback

Callers

nothing calls this directly

Calls 1

searchFunction · 0.90

Tested by

no test coverage detected