forked from pydantic/pydantic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug with mypy plugin and
no_strict_optional = True
(pydantic#8666)
- Loading branch information
Showing
5 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
tests/mypy/configs/pyproject-plugin-no-strict-optional.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[build-system] | ||
requires = ["poetry>=0.12"] | ||
build_backend = "poetry.masonry.api" | ||
|
||
[tool.poetry] | ||
name = "test" | ||
version = "0.0.1" | ||
readme = "README.md" | ||
authors = [ | ||
"[email protected]" | ||
] | ||
|
||
[tool.poetry.dependencies] | ||
python = "*" | ||
|
||
[tool.pytest.ini_options] | ||
addopts = "-v -p no:warnings" | ||
|
||
[tool.mypy] | ||
plugins = [ | ||
"pydantic.mypy" | ||
] | ||
follow_imports = "silent" | ||
no_strict_optional = true | ||
warn_redundant_casts = true | ||
warn_unused_ignores = true | ||
disallow_any_generics = true | ||
check_untyped_defs = true | ||
no_implicit_reexport = true | ||
disallow_untyped_defs = true | ||
|
||
[[tool.mypy.overrides]] | ||
module = [ | ||
'pydantic_core.*', | ||
] | ||
follow_imports = "skip" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from typing import Union | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
class MongoSettings(BaseModel): | ||
MONGO_PASSWORD: Union[str, None] |
7 changes: 7 additions & 0 deletions
7
tests/mypy/outputs/1.0.1/pyproject-plugin-no-strict-optional_toml/no_strict_optional.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from typing import Union | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
class MongoSettings(BaseModel): | ||
MONGO_PASSWORD: Union[str, None] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters