MCPcopy Create free account
hub / github.com/MemTensor/MemOS / check_config_instantiation_invalid

Function check_config_instantiation_invalid

tests/utils.py:208–225  ·  view source on GitHub ↗

Test that invalid configurations raise the appropriate exceptions. Args: cls: The config class to test invalid_config: Dictionary of invalid configuration values

(cls: BaseModel, invalid_config: dict | None = None)

Source from the content-addressed store, hash-verified

206
207
208def check_config_instantiation_invalid(cls: BaseModel, invalid_config: dict | None = None) -> None:
209 """
210 Test that invalid configurations raise the appropriate exceptions.
211
212 Args:
213 cls: The config class to test
214 invalid_config: Dictionary of invalid configuration values
215 """
216 invalid_configs = [
217 {"impossible_field": "invalid_value"},
218 {"another_impossible_field": 2},
219 {"abcdef": 0.1, "ghijk": "lmn"},
220 ]
221 if invalid_config is not None:
222 invalid_configs.append(invalid_config)
223 for invalid_config in invalid_configs:
224 with pytest.raises((ValueError, TypeError, Exception)):
225 cls.model_validate(invalid_config)

Callers 15

test_base_llm_configFunction · 0.90
test_openai_llm_configFunction · 0.90
test_ollama_llm_configFunction · 0.90
test_hf_llm_configFunction · 0.90
test_minimax_llm_configFunction · 0.90
test_llm_config_factoryFunction · 0.90
test_base_vec_db_configFunction · 0.90

Calls

no outgoing calls

Tested by 15

test_base_llm_configFunction · 0.72
test_openai_llm_configFunction · 0.72
test_ollama_llm_configFunction · 0.72
test_hf_llm_configFunction · 0.72
test_minimax_llm_configFunction · 0.72
test_llm_config_factoryFunction · 0.72
test_base_vec_db_configFunction · 0.72