mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
6b8d2babaa
* Fix #947, fix #1483, fix #1247 allow inner type vars to be present in parent generic classes - Rename generics._is_type to _is_generic in response to comment: https://github.com/samuelcolvin/pydantic/pull/1989#discussion_r503400391 - Add more explicit type assertion in generics test - Add generics tests and unify naming - Move deep generic tests all into same place in code - Unify naming convention in deep generic tests using naming of existing tests - Add tests for multiple inheritance and multiple type vars - Add generic tests for type hint resolution cases - Fix edge cases for handling parameters in generic models - Resolve parameters correctly - Add tests for special cases like callables - Add returning generic type directly if parameters and arguments are identical. * Apply review comments - Add docstrings - Small refactor `generics.__concrete_name__` - Small refactor of `generics.resolve_type_hints` - Change `is_identity_typevars_map` to more generic and clearer `all_identical` and move into utils. - rename "resolve_type_hint" to "replace_types" so as to not get confused with "resolve_annotations" from `pydantic.typing` * Fix generics test coverage * Update pydantic/generics.py, remove unneeded annotation mypy understands list comprehensions as they are now Co-authored-by: Eric Jolibois <em.jolibois@gmail.com> Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
197 B
197 B
Fix bug where generic models with fields where the typevar is nested in another type a: List[T] are considered to be concrete. This allows these models to be subclassed and composed as expected.