MCPcopy
hub / github.com/pydantic/pydantic / test_config_wrapper_match

Function test_config_wrapper_match

tests/test_config.py:523–541  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

521
522@pytest.mark.thread_unsafe(reason='Flaky')
523def test_config_wrapper_match():
524 localns = {
525 '_GenerateSchema': GenerateSchema,
526 'GenerateSchema': GenerateSchema,
527 'JsonValue': JsonValue,
528 'FieldInfo': FieldInfo,
529 'ComputedFieldInfo': ComputedFieldInfo,
530 }
531 config_dict_annotations = [(k, str(v)) for k, v in get_type_hints(ConfigDict, localns=localns).items()]
532 config_dict_annotations.sort()
533 # remove config
534 config_wrapper_annotations = [
535 (k, str(v)) for k, v in get_type_hints(ConfigWrapper, localns=localns).items() if k != 'config_dict'
536 ]
537 config_wrapper_annotations.sort()
538
539 assert config_dict_annotations == config_wrapper_annotations, (
540 'ConfigDict and ConfigWrapper must have the same annotations (except ConfigWrapper.config_dict)'
541 )
542
543
544@pytest.mark.skipif(sys.version_info < (3, 11), reason='requires backport pre 3.11, fully tested in pydantic core')

Callers

nothing calls this directly

Calls 3

get_type_hintsFunction · 0.90
sortMethod · 0.80
itemsMethod · 0.45

Tested by

no test coverage detected