Skip to content

Commit

Permalink
docs: make TypeAdapter example PEP-8 compliant
Browse files Browse the repository at this point in the history
  • Loading branch information
vagenas committed Apr 17, 2024
1 parent ae71183 commit 2aa724f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/concepts/type_adapter.md
Expand Up @@ -25,12 +25,12 @@ class User(TypedDict):
id: int


UserListAdapter = TypeAdapter(List[User])
print(repr(UserListAdapter.validate_python([{'name': 'Fred', 'id': '3'}])))
user_list_adapter = TypeAdapter(List[User])
print(repr(user_list_adapter.validate_python([{'name': 'Fred', 'id': '3'}])))
#> [{'name': 'Fred', 'id': 3}]

try:
UserListAdapter.validate_python(
user_list_adapter.validate_python(
[{'name': 'Fred', 'id': 'wrong', 'other': 'no'}]
)
except ValidationError as e:
Expand Down

0 comments on commit 2aa724f

Please sign in to comment.