## Change Summary

Ensure that a `SecretStr` type can be populated from json.

## Related issue number

Fix #7720

## Checklist

* [x] The pull request title is a good summary of the changes - it will be used in the changelog
* [x] Unit tests for the changes exist
* [x] Tests pass on CI
* [ ] Documentation reflects the changes where applicable
* [x] My PR is ready to review, **please add a comment including the phrase "please review" to assign reviewers**


Selected Reviewer: @samuelcolvin
Fix failure to load `SecretStr` from JSON (regression in v2.4). ## Change Summary

Ensure that a `SecretStr` type can be populated from json.

## Related issue number

Fix #7720

## Checklist

* [x] The pull request title is a good summary of the changes - it will be used in the changelog
* [x] Unit tests for the changes exist
* [x] Tests pass on CI
* [ ] Documentation reflects the changes where applicable
* [x] My PR is ready to review, **please add a comment including the phrase "please review" to assign reviewers**


Selected Reviewer: @samuelcolvin
"""
Test mypy failure with invalid types.
"""
from typing import Generic, List, TypeVar

from pydantic import BaseModel

T = TypeVar('T')


class Model(BaseModel):
    list_of_ints: List[int]


class WrapperModel(BaseModel, Generic[T]):
    payload: T


model_instance = Model(list_of_ints=[1])
wrapper_instance = WrapperModel[Model](payload=model_instance)
wrapper_instance.payload.list_of_ints.append('1')
# MYPY: error: Argument 1 to "append" of "list" has incompatible type "str"; expected "int"  [arg-type]

"""
Test mypy failure with invalid types.
"""
from typing import Generic, List, TypeVar

from pydantic import BaseModel

T = TypeVar('T')


class Model(BaseModel):
    list_of_ints: List[int]


class WrapperModel(BaseModel, Generic[T]):
    payload: T


model_instance = Model(list_of_ints=[1])
wrapper_instance = WrapperModel[Model](payload=model_instance)
wrapper_instance.payload.list_of_ints.append('1')
# MYPY: error: Argument 1 to "append" of "list" has incompatible type "str"; expected "int"  [arg-type]
