def test_validate_query_dict_by_search_method(self):
        """Test dictionary query validation for different search methods."""
        test_cases = [
            (SearchMethod.TENSOR, True, "should succeed for TENSOR"),
            (SearchMethod.LEXICAL, False, "Multi-term query is not supported for search_method=\"LEXICAL\""),
            (SearchMethod.HYBRID, False, "To use multi-term query with search_method=\"HYBRID\"")
        ]

        for search_method, should_succeed, expected_error_fragment in test_cases:
            with self.subTest(search_method=search_method):
                if should_succeed:
                    result = validation.validate_query(self.valid_dict_query, search_method)
                    self.assertEqual(result, self.valid_dict_query)
                else:
                    with self.assertRaises(InvalidArgError) as cm:
                        validation.validate_query(self.valid_dict_query, search_method)
                    error_msg = str(cm.exception)
                    self.assertIn(expected_error_fragment, error_msg)
                    if search_method == SearchMethod.HYBRID:
                        self.assertIn("hybrid_parameters.queryTensor", error_msg)
Test dictionary query validation for different search methods.
tests/unit_tests/marqo/tensor_search/test_validation.py