This paste expires on 2023-05-23 15:10:11.477398. Repaste, or download this paste. . Pasted through web.

>>> from pydantic import BaseModel
>>> from pydantic import BaseModel
>>>
>>> class Foo(BaseModel):
...   bar: list[int]
...
>>>
>>> Foo.parse_obj({"bar": [9]}).bar[0]
9
>>> Foo.parse_obj({"bar": ["9"]}).bar[0]
9
>>> Foo.parse_obj({"bar": [9.8]}).bar[0]
9
>>> Foo.parse_obj({"bar": ["9.8"]}).bar[0]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pydantic/main.py", line 526, in pydantic.main.BaseModel.parse_obj
  File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for Foo
bar -> 0
  value is not a valid integer (type=type_error.integer)
Filename: None. Size: 677b. View raw, , hex, or download this file.