You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the code below, mypy 1.5.0 and 1.5.1 give the following output:
pydantic_hmm.py:24: note: Revealed type is "pydantic_hmm.Data"
pydantic_hmm.py:25: error: Right operand of "and" is never evaluated [unreachable]
This is not what I expected - the type should be Optional[Data]. When the test is run, it passes and the right-hand side of the assertion does get evaluated.
This works as expected with mypy 1.4.1. Here's its output:
pydantic_hmm.py:24: note: Revealed type is "Union[pydantic_hmm.Data, None]"
For what it's worth, Pylance gives the same revealed type as mypy 1.4.1.
I'm not sure if this is a Pydantic issue or a mypy issue, but I wasn't able to reproduce this without using BaseModel and pydantic.mypy mypy plugin so I'm reporting it here.
Initial Checks
Description
For the code below, mypy 1.5.0 and 1.5.1 give the following output:
This is not what I expected - the type should be
Optional[Data]
. When the test is run, it passes and the right-hand side of the assertion does get evaluated.This works as expected with mypy 1.4.1. Here's its output:
For what it's worth, Pylance gives the same revealed type as mypy 1.4.1.
I'm not sure if this is a Pydantic issue or a mypy issue, but I wasn't able to reproduce this without using
BaseModel
andpydantic.mypy
mypy plugin so I'm reporting it here.Example Code
mypy.ini:
Python, Pydantic & OS Version
Selected Assignee: @Kludex
The text was updated successfully, but these errors were encountered: