Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
Fixes for py3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
seandstewart committed Feb 27, 2024
1 parent bc1bb97 commit 6b91b6b
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 16 deletions.
107 changes: 98 additions & 9 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ astunparse = {version = "^1.6.3", python = "<3.9"}
[tool.poetry.group.test.dependencies]
pytest = "^8"
pytest-cov = "^4"
pandas = "^2"
pandas = [
{ version = "^2.2.0", python = ">=3.9" },
{ version = "^2.0.0", python = "<3.9" }
]
sqlalchemy = "^2"
asyncpg = "^0.29"
pytest-parametrize-suite = "^23.1.1"
Expand All @@ -54,7 +57,10 @@ pytest-benchmark = {version = "^4", extras = ["histogram"]}
marshmallow = "^3"
djangorestframework = "^3"
pydantic = {version = "^2", extras = ["email"]}
django = "^4"
django = [
{ version = "^4", python = "<3.10" },
{ version = "^5", python = ">=3.10" }
]
apischema = "^0.18"

[tool.poetry.group.lint.dependencies]
Expand Down
4 changes: 2 additions & 2 deletions src/typical/types/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class FilePath(PathType): # type: ignore
"""

def __init__(self, *pathsegments: str):
super().__init__()
super().__init__(*pathsegments)
if not self.is_file():
raise FilePathError(f"{self} is not a valid file-path") from None

Expand All @@ -41,6 +41,6 @@ class DirectoryPath(PathType): # type: ignore
"""

def __init__(self, *pathsegments: str):
super().__init__()
super().__init__(*pathsegments)
if not self.is_dir():
raise DirectoryPathError(f"{self} is not a valid directory-path") from None
2 changes: 1 addition & 1 deletion tests/legacy/custom_types/test_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@pytest.mark.parametrize(
argnames=("path", "cls"),
argvalues=[("/some/path/", FilePath), ("/some/path", DirectoryPath)],
argvalues=[("/some/path/", FilePath), ("/some/path.pth", DirectoryPath)],
)
def test_invalid_path(path, cls):
with pytest.raises(ValueError):
Expand Down
4 changes: 2 additions & 2 deletions tests/legacy/test_typed.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ def test_isbuiltintype(obj: typing.Any):
(uuid.UUID, str(uuid.UUID(int=1)), uuid.UUID(int=1)),
(uuid.UUID, uuid.UUID(int=1).fields, uuid.UUID(int=1)),
(SubUUID, uuid.UUID(int=1), SubUUID(int=1)),
(DirectoryPath, pathlib.Path.cwd(), DirectoryPath.cwd()),
(pathlib.Path, DirectoryPath.cwd(), pathlib.Path.cwd()),
(DirectoryPath, pathlib.Path.cwd().resolve(), DirectoryPath.cwd().resolve()),
(pathlib.Path, DirectoryPath.cwd().resolve(), pathlib.Path.cwd().resolve()),
(objects.FromDict, {"foo": "bar!"}, objects.FromDict("bar!")),
(objects.Data, {"foo": "bar!"}, objects.Data("bar!")),
(dict, objects.Data("bar!"), {"foo": "bar!"}),
Expand Down

0 comments on commit 6b91b6b

Please sign in to comment.