def test_validate_query_dict_validation_rules(self):
        """Test dictionary validation rules for structure and content."""
        test_cases = [
            # (query, should_succeed, expected_error_fragment, description)
            ({}, False, "Multi-term query requires at least one query", "empty dict"),
            ({123: 1.0, "cats": 0.5}, False, "Found key of type `<class 'int'>` instead of string", "invalid key type"),
            ({"dogs": "not_a_number", "cats": 0.5}, False, "Found value of type `<class 'str'>` instead of float",
             "invalid value type"),
            ({"dogs": 1, "cats": 2}, True, None, "valid int values"),
            ({"dogs": 1.5, "cats": 2.7}, True, None, "valid float values"),
            ({"dogs": 1, "cats": 2.5, "birds": 0}, True, None, "mixed numeric values"),
            ({"dogs": 0.0, "cats": -1.5, "birds": float('inf')}, True, None, "special float values"),
            ({"dogs": -1, "cats": -2.5}, True, None, "negative values"),
            ({"query": 1.0}, True, None, "single item dictionary")
        ]

        for query, should_succeed, expected_error_fragment, description in test_cases:
            with self.subTest(description=description):
                if should_succeed:
                    result = validation.validate_query(query, SearchMethod.TENSOR)
                    self.assertEqual(result, query)
                else:
                    with self.assertRaises(InvalidArgError) as cm:
                        validation.validate_query(query, SearchMethod.TENSOR)
                    error_msg = str(cm.exception)
                    self.assertIn(expected_error_fragment, error_msg)
Test dictionary validation rules for structure and content.
tests/unit_tests/marqo/tensor_search/test_validation.py