-
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.
- Drop support for Python 3.8, this was causing compatibility issues with slices
- Loading branch information
Showing
12 changed files
with
308 additions
and
21 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
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
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 |
---|---|---|
|
@@ -10,13 +10,12 @@ readme = "README.md" | |
authors = [ | ||
{name = "Victorien", email = "[email protected]"} | ||
] | ||
requires-python = ">=3.8" | ||
requires-python = ">=3.9" | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
|
@@ -54,7 +53,7 @@ where = ["src"] | |
[tool.ruff] | ||
line-length = 120 | ||
src = ["src"] | ||
target-version = "py38" | ||
target-version = "py39" | ||
|
||
[tool.ruff.lint] | ||
preview = true | ||
|
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
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
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
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
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
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,33 @@ | ||
from __future__ import annotations | ||
|
||
import ast | ||
|
||
import pytest | ||
|
||
from flake8_pydantic.errors import PYD003, Error | ||
from flake8_pydantic.visitor import Visitor | ||
|
||
PYD003_NOT_OK = """ | ||
class Model(BaseModel): | ||
a: int = Field(default=1) | ||
""" | ||
|
||
PYD003_OK = """ | ||
class Model(BaseModel): | ||
a: int = Field(default=1, description="") | ||
""" | ||
|
||
|
||
@pytest.mark.parametrize( | ||
["source", "expected"], | ||
[ | ||
(PYD003_NOT_OK, [PYD003(3, 4)]), | ||
(PYD003_OK, []), | ||
], | ||
) | ||
def test_pyd003(source: str, expected: list[Error]) -> None: | ||
module = ast.parse(source) | ||
visitor = Visitor() | ||
visitor.visit(module) | ||
|
||
assert visitor.errors == expected |
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,33 @@ | ||
from __future__ import annotations | ||
|
||
import ast | ||
|
||
import pytest | ||
|
||
from flake8_pydantic.errors import PYD004, Error | ||
from flake8_pydantic.visitor import Visitor | ||
|
||
PYD004_1 = """ | ||
class Model(BaseModel): | ||
a: Annotated[int, Field(default=1, description="")] | ||
""" | ||
|
||
PYD004_2 = """ | ||
class Model(BaseModel): | ||
a: Annotated[int, Unrelated(), Field(default=1)] | ||
""" | ||
|
||
|
||
@pytest.mark.parametrize( | ||
["source", "expected"], | ||
[ | ||
(PYD004_1, [PYD004(3, 4)]), | ||
(PYD004_2, [PYD004(3, 4)]), | ||
], | ||
) | ||
def test_pyd004(source: str, expected: list[Error]) -> None: | ||
module = ast.parse(source) | ||
visitor = Visitor() | ||
visitor.visit(module) | ||
|
||
assert visitor.errors == expected |
Oops, something went wrong.