diff --git a/pyproject.toml b/pyproject.toml index 449bd78ba..f31e47e0f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ dev = [ "greenlet >= 3.1.1, < 3.2", # for sqlalchemy async "hatch >= 1.14.0, < 1.15", "httpx >= 0.28.1, < 0.29", # for fastapi - "hypothesis >= 6.123.11, < 6.124", + "hypothesis >= 6.123.13, < 6.124", "ib-async-dataclass >= 1.0.3rc5, < 1.1", "img2pdf >= 0.5.1, < 0.6", "loguru >= 0.7.3, < 0.8", @@ -50,10 +50,11 @@ dev = [ "numpy >= 2.0.2, < 2.1", # if 2.1, llvmite: RuntimeError: Cannot install on Python version 3.11.9; only versions >=3.6,<3.10 are supported. "optuna >= 4.1.0, < 4.2", "orjson >= 3.10.14, < 3.11", + "pathvalidate >= 3.2.3, < 3.3", "polars-lts-cpu >= 1.19.0, < 1.20", "pqdm >= 0.2.0, < 0.3", "psycopg2-binary >= 2.9.10, < 2.10", # for sqlalchemy - "pydantic >= 2.10.4, < 2.11", + "pydantic >= 2.10.5, < 2.11", "pyhumps >= 3.8.0, < 3.9", "pyinstrument >= 5.0.0, < 5.1", "pyrsistent >= 0.20.0, < 0.21", @@ -63,7 +64,7 @@ dev = [ "rich >= 13.8.1, < 13.9", # if 13.9, twine upload fails https://github.com/dycw/python-utilities/actions/runs/11125686648/job/30913966455 "scipy >= 1.15.0, < 1.16", "slack-sdk >= 3.34.0, < 3.35", - "sqlalchemy >= 2.0.36, < 2.1", + "sqlalchemy >= 2.0.37, < 2.1", "streamlit >= 1.41.1, < 1.42", "tenacity >= 9.0.0, < 9.1", "treelib >= 1.7.0, < 1.8", @@ -89,7 +90,7 @@ dev = [ ] test = [ "coverage-conditional-plugin >= 0.9.0, < 0.10", - "hypothesis >= 6.123.11, < 6.124", + "hypothesis >= 6.123.13, < 6.124", "pytest >= 8.3.4, < 8.4", "pytest-asyncio >= 0.25.2, < 0.26", "pytest-cov >= 6.0.0, < 6.1", @@ -117,7 +118,7 @@ zzz-test-beartype = ["beartype >= 0.19.0, < 0.20"] zzz-test-cachetools = ["cachetools >= 5.5.0, < 5.6"] zzz-test-click = [ "click >= 8.1.8, < 8.2", - "sqlalchemy >= 2.0.36, < 2.1", + "sqlalchemy >= 2.0.37, < 2.1", "whenever >= 0.6.16, < 0.7", ] zzz-test-contextlib = [] @@ -165,10 +166,11 @@ zzz-test-hypothesis = [ "aiosqlite >= 0.20.0, < 0.21", "asyncpg >= 0.30.0, < 0.31", # for sqlalchemy async "greenlet >= 3.1.1, < 3.2", # for sqlalchemy async - "hypothesis >= 6.123.11, < 6.124", + "hypothesis >= 6.123.13, < 6.124", "numpy >= 2.0.2, < 2.1", + "pathvalidate >= 3.2.3, < 3.3", "redis >= 5.2.1, < 5.3", - "sqlalchemy >= 2.0.36, < 2.1", + "sqlalchemy >= 2.0.37, < 2.1", "tenacity >= 9.0.0, < 9.1", "tzlocal >= 5.2, < 5.3", "whenever >= 0.6.16, < 0.7", @@ -229,7 +231,7 @@ zzz-test-polars = [ zzz-test-pqdm = ["pqdm >= 0.2.0, < 0.3"] zzz-test-pydantic = [ "atomicwrites >= 1.4.1, < 1.5", - "pydantic >= 2.10.4, < 2.11", + "pydantic >= 2.10.5, < 2.11", ] zzz-test-pyinstrument = [ "atomicwrites >= 1.4.1, < 1.5", @@ -269,7 +271,7 @@ zzz-test-sqlalchemy = [ "greenlet >= 3.1.1, < 3.2", # for sqlalchemy async "nest-asyncio >= 1.6.0, < 1.7", # for sqlalchemy async "pyhumps >= 3.8.0, < 3.9", - "sqlalchemy >= 2.0.36, < 2.1", + "sqlalchemy >= 2.0.37, < 2.1", "tenacity >= 9.0.0, < 9.1", ] zzz-test-sqlalchemy-polars = [ @@ -279,7 +281,7 @@ zzz-test-sqlalchemy-polars = [ "nest-asyncio >= 1.6.0, < 1.7", # for sqlalchemy async "polars-lts-cpu >= 1.19.0, < 1.20", "pyhumps >= 3.8.0, < 3.9", - "sqlalchemy >= 2.0.36, < 2.1", + "sqlalchemy >= 2.0.37, < 2.1", "tenacity >= 9.0.0, < 9.1", ] zzz-test-streamlit = ["streamlit >= 1.41.1, < 1.42"] diff --git a/requirements.txt b/requirements.txt index 313b38fc7..5a08751f6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -142,7 +142,7 @@ humanfriendly==10.0 # via coloredlogs hyperlink==21.0.0 # via hatch -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) ib-async-dataclass==1.0.3rc5 # via dycw-utilities (pyproject.toml) @@ -256,6 +256,8 @@ pandas==2.2.3 # via streamlit pathspec==0.12.1 # via hatchling +pathvalidate==3.2.3 + # via dycw-utilities (pyproject.toml) pexpect==4.9.0 # via hatch pikepdf==9.5.1 @@ -296,7 +298,7 @@ pyarrow==18.1.0 # via streamlit pycparser==2.22 # via cffi -pydantic==2.10.4 +pydantic==2.10.5 # via # dycw-utilities (pyproject.toml) # fastapi @@ -389,7 +391,7 @@ sniffio==1.3.1 # via anyio sortedcontainers==2.4.0 # via hypothesis -sqlalchemy==2.0.36 +sqlalchemy==2.0.37 # via # dycw-utilities (pyproject.toml) # alembic diff --git a/requirements/altair.txt b/requirements/altair.txt index 16220d428..1888d2140 100644 --- a/requirements/altair.txt +++ b/requirements/altair.txt @@ -19,7 +19,7 @@ deprecated==1.2.15 # via pikepdf execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) img2pdf==0.5.1 # via dycw-utilities (pyproject.toml) diff --git a/requirements/astor.txt b/requirements/astor.txt index f9737c3e2..8a83aa625 100644 --- a/requirements/astor.txt +++ b/requirements/astor.txt @@ -12,7 +12,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/asyncio.txt b/requirements/asyncio.txt index ffd9810ef..04a34a116 100644 --- a/requirements/asyncio.txt +++ b/requirements/asyncio.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/atomicwrites.txt b/requirements/atomicwrites.txt index 733b36f42..880710eb4 100644 --- a/requirements/atomicwrites.txt +++ b/requirements/atomicwrites.txt @@ -12,7 +12,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/atools.txt b/requirements/atools.txt index 4096043cc..40ef8d7c2 100644 --- a/requirements/atools.txt +++ b/requirements/atools.txt @@ -14,7 +14,7 @@ execnet==2.1.1 # via pytest-xdist frozendict==2.4.6 # via atools -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/beartype.txt b/requirements/beartype.txt index 2390d62e6..0b1186e66 100644 --- a/requirements/beartype.txt +++ b/requirements/beartype.txt @@ -12,7 +12,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/cachetools.txt b/requirements/cachetools.txt index 8ca31cb48..604777cb7 100644 --- a/requirements/cachetools.txt +++ b/requirements/cachetools.txt @@ -12,7 +12,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/click.txt b/requirements/click.txt index 418a6e221..166db5f89 100644 --- a/requirements/click.txt +++ b/requirements/click.txt @@ -12,7 +12,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest @@ -49,7 +49,7 @@ pytest-xdist==3.6.1 # via dycw-utilities (pyproject.toml) sortedcontainers==2.4.0 # via hypothesis -sqlalchemy==2.0.36 +sqlalchemy==2.0.37 # via dycw-utilities (pyproject.toml) tomli==2.2.1 # via coverage diff --git a/requirements/contextlib.txt b/requirements/contextlib.txt index bf9307912..098f19228 100644 --- a/requirements/contextlib.txt +++ b/requirements/contextlib.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/cryptography.txt b/requirements/cryptography.txt index 8d0ea9113..8d347b633 100644 --- a/requirements/cryptography.txt +++ b/requirements/cryptography.txt @@ -14,7 +14,7 @@ cryptography==44.0.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/cvxpy.txt b/requirements/cvxpy.txt index f4c42eede..f0f5b7200 100644 --- a/requirements/cvxpy.txt +++ b/requirements/cvxpy.txt @@ -14,7 +14,7 @@ cvxpy==1.6.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/dataclasses.txt b/requirements/dataclasses.txt index 7e0e10815..ecdce2895 100644 --- a/requirements/dataclasses.txt +++ b/requirements/dataclasses.txt @@ -12,7 +12,7 @@ eventkit==1.0.3 # via ib-async-dataclass execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) ib-async-dataclass==1.0.3rc5 # via dycw-utilities (pyproject.toml) diff --git a/requirements/datetime.txt b/requirements/datetime.txt index f5fbb9a9d..4a500550e 100644 --- a/requirements/datetime.txt +++ b/requirements/datetime.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/enum.txt b/requirements/enum.txt index b2c2e5d4b..d3f771914 100644 --- a/requirements/enum.txt +++ b/requirements/enum.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/errors.txt b/requirements/errors.txt index 8ef9ef5b9..21378686a 100644 --- a/requirements/errors.txt +++ b/requirements/errors.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/eventkit.txt b/requirements/eventkit.txt index b4a7d0ba7..25f9739cd 100644 --- a/requirements/eventkit.txt +++ b/requirements/eventkit.txt @@ -12,7 +12,7 @@ eventkit==1.0.3 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/fastapi.txt b/requirements/fastapi.txt index b9c9d3bef..cb8871c77 100644 --- a/requirements/fastapi.txt +++ b/requirements/fastapi.txt @@ -32,7 +32,7 @@ httpcore==1.0.7 # via httpx httpx==0.28.1 # via dycw-utilities (pyproject.toml) -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) idna==3.10 # via @@ -47,7 +47,7 @@ packaging==24.2 # pytest-rerunfailures pluggy==1.5.0 # via pytest -pydantic==2.10.4 +pydantic==2.10.5 # via fastapi pydantic-core==2.27.2 # via pydantic diff --git a/requirements/fpdf2.txt b/requirements/fpdf2.txt index aa8348ab9..c026a43c9 100644 --- a/requirements/fpdf2.txt +++ b/requirements/fpdf2.txt @@ -16,7 +16,7 @@ fonttools==4.55.3 # via fpdf2 fpdf2==2.8.2 # via dycw-utilities (pyproject.toml) -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/functions.txt b/requirements/functions.txt index 0d44fb582..afca117be 100644 --- a/requirements/functions.txt +++ b/requirements/functions.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/functools.txt b/requirements/functools.txt index 80bf9599c..ed39b6cf4 100644 --- a/requirements/functools.txt +++ b/requirements/functools.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/getpass.txt b/requirements/getpass.txt index 86301e4ba..b5a0d2167 100644 --- a/requirements/getpass.txt +++ b/requirements/getpass.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/git.txt b/requirements/git.txt index 24a0d44b6..de28ceaf8 100644 --- a/requirements/git.txt +++ b/requirements/git.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/hashlib.txt b/requirements/hashlib.txt index 2d13f481c..dae7ea2fd 100644 --- a/requirements/hashlib.txt +++ b/requirements/hashlib.txt @@ -12,7 +12,7 @@ eventkit==1.0.3 # via ib-async-dataclass execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) ib-async-dataclass==1.0.3rc5 # via dycw-utilities (pyproject.toml) diff --git a/requirements/http.txt b/requirements/http.txt index 988fe9f11..3cbc70cf4 100644 --- a/requirements/http.txt +++ b/requirements/http.txt @@ -12,7 +12,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/humps.txt b/requirements/humps.txt index fae5d1660..987d3f324 100644 --- a/requirements/humps.txt +++ b/requirements/humps.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/hypothesis.txt b/requirements/hypothesis.txt index c7ebe5e5f..cd1b2d954 100644 --- a/requirements/hypothesis.txt +++ b/requirements/hypothesis.txt @@ -18,7 +18,7 @@ execnet==2.1.1 # via pytest-xdist greenlet==3.1.1 # via dycw-utilities (pyproject.toml) -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest @@ -29,6 +29,8 @@ packaging==24.2 # coverage-conditional-plugin # pytest # pytest-rerunfailures +pathvalidate==3.2.3 + # via dycw-utilities (pyproject.toml) pluggy==1.5.0 # via pytest pytest==8.3.4 @@ -59,7 +61,7 @@ redis==5.2.1 # via dycw-utilities (pyproject.toml) sortedcontainers==2.4.0 # via hypothesis -sqlalchemy==2.0.36 +sqlalchemy==2.0.37 # via dycw-utilities (pyproject.toml) tenacity==9.0.0 # via dycw-utilities (pyproject.toml) diff --git a/requirements/ipython.txt b/requirements/ipython.txt index 8d0634574..69c3ff89f 100644 --- a/requirements/ipython.txt +++ b/requirements/ipython.txt @@ -16,7 +16,7 @@ execnet==2.1.1 # via pytest-xdist executing==2.1.0 # via stack-data -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/iterables.txt b/requirements/iterables.txt index 68eff58d1..d7c6620b1 100644 --- a/requirements/iterables.txt +++ b/requirements/iterables.txt @@ -12,7 +12,7 @@ eventkit==1.0.3 # via ib-async-dataclass execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) ib-async-dataclass==1.0.3rc5 # via dycw-utilities (pyproject.toml) diff --git a/requirements/jupyter.txt b/requirements/jupyter.txt index d15160793..dfda3cc83 100644 --- a/requirements/jupyter.txt +++ b/requirements/jupyter.txt @@ -64,7 +64,7 @@ httpcore==1.0.7 # via httpx httpx==0.28.1 # via jupyterlab -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) idna==3.10 # via diff --git a/requirements/logging.txt b/requirements/logging.txt index e93af49cd..199c46950 100644 --- a/requirements/logging.txt +++ b/requirements/logging.txt @@ -46,7 +46,7 @@ humanfriendly==10.0 # via coloredlogs hyperlink==21.0.0 # via hatch -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) idna==3.10 # via diff --git a/requirements/loguru.txt b/requirements/loguru.txt index cd6110f64..9386ffb2b 100644 --- a/requirements/loguru.txt +++ b/requirements/loguru.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/math.txt b/requirements/math.txt index 48bcedc76..36f1040d2 100644 --- a/requirements/math.txt +++ b/requirements/math.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/memory-profiler.txt b/requirements/memory-profiler.txt index dccaab6e6..9aaa3b761 100644 --- a/requirements/memory-profiler.txt +++ b/requirements/memory-profiler.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/modules.txt b/requirements/modules.txt index 67b9053b5..9ea30f018 100644 --- a/requirements/modules.txt +++ b/requirements/modules.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/more-itertools.txt b/requirements/more-itertools.txt index 1ded6b9cd..32a59ec55 100644 --- a/requirements/more-itertools.txt +++ b/requirements/more-itertools.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/numpy.txt b/requirements/numpy.txt index 53661f17a..c0f21d493 100644 --- a/requirements/numpy.txt +++ b/requirements/numpy.txt @@ -12,7 +12,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/optuna.txt b/requirements/optuna.txt index 548a368fb..915d84d76 100644 --- a/requirements/optuna.txt +++ b/requirements/optuna.txt @@ -14,7 +14,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest @@ -62,7 +62,7 @@ pyyaml==6.0.2 # via optuna sortedcontainers==2.4.0 # via hypothesis -sqlalchemy==2.0.36 +sqlalchemy==2.0.37 # via # alembic # optuna diff --git a/requirements/orjson.txt b/requirements/orjson.txt index 612f93944..2f817b8b9 100644 --- a/requirements/orjson.txt +++ b/requirements/orjson.txt @@ -12,7 +12,7 @@ eventkit==1.0.3 # via ib-async-dataclass execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) ib-async-dataclass==1.0.3rc5 # via dycw-utilities (pyproject.toml) diff --git a/requirements/os.txt b/requirements/os.txt index c05d079e6..37745e460 100644 --- a/requirements/os.txt +++ b/requirements/os.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/pathlib.txt b/requirements/pathlib.txt index f10ad0a06..03b8ad48d 100644 --- a/requirements/pathlib.txt +++ b/requirements/pathlib.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/pickle.txt b/requirements/pickle.txt index f74b9f037..67f6b6ea6 100644 --- a/requirements/pickle.txt +++ b/requirements/pickle.txt @@ -12,7 +12,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/platform.txt b/requirements/platform.txt index 3b8943602..9fc53f055 100644 --- a/requirements/platform.txt +++ b/requirements/platform.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/polars.txt b/requirements/polars.txt index a6de98dcb..399ec621b 100644 --- a/requirements/polars.txt +++ b/requirements/polars.txt @@ -12,7 +12,7 @@ dacite==1.8.1 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/pqdm.txt b/requirements/pqdm.txt index b41cde8ca..fb7e9a4f4 100644 --- a/requirements/pqdm.txt +++ b/requirements/pqdm.txt @@ -12,7 +12,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/pydantic.txt b/requirements/pydantic.txt index b9f87dbbd..43c48621f 100644 --- a/requirements/pydantic.txt +++ b/requirements/pydantic.txt @@ -14,7 +14,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest @@ -25,7 +25,7 @@ packaging==24.2 # pytest-rerunfailures pluggy==1.5.0 # via pytest -pydantic==2.10.4 +pydantic==2.10.5 # via dycw-utilities (pyproject.toml) pydantic-core==2.27.2 # via pydantic diff --git a/requirements/pyinstrument.txt b/requirements/pyinstrument.txt index 7958a7e2e..11e30ee6f 100644 --- a/requirements/pyinstrument.txt +++ b/requirements/pyinstrument.txt @@ -12,7 +12,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/pyrsistent.txt b/requirements/pyrsistent.txt index b6001e36f..a49acabc7 100644 --- a/requirements/pyrsistent.txt +++ b/requirements/pyrsistent.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/pytest.txt b/requirements/pytest.txt index 7e46436cc..363949fcd 100644 --- a/requirements/pytest.txt +++ b/requirements/pytest.txt @@ -12,7 +12,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/python-dotenv.txt b/requirements/python-dotenv.txt index c85154489..cc1e37e10 100644 --- a/requirements/python-dotenv.txt +++ b/requirements/python-dotenv.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/random.txt b/requirements/random.txt index 298b8d113..6c486fce5 100644 --- a/requirements/random.txt +++ b/requirements/random.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/re.txt b/requirements/re.txt index 080b75e80..0ecd260f3 100644 --- a/requirements/re.txt +++ b/requirements/re.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/redis.txt b/requirements/redis.txt index f211dd12d..6c67b8438 100644 --- a/requirements/redis.txt +++ b/requirements/redis.txt @@ -14,7 +14,7 @@ eventkit==1.0.3 # via ib-async-dataclass execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) ib-async-dataclass==1.0.3rc5 # via dycw-utilities (pyproject.toml) diff --git a/requirements/rich.txt b/requirements/rich.txt index 3f52430b0..915e44da6 100644 --- a/requirements/rich.txt +++ b/requirements/rich.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/scipy.txt b/requirements/scipy.txt index b3f9a6933..46933a7b3 100644 --- a/requirements/scipy.txt +++ b/requirements/scipy.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/sentinel.txt b/requirements/sentinel.txt index 7436796a2..ad677fd46 100644 --- a/requirements/sentinel.txt +++ b/requirements/sentinel.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/slack-sdk.txt b/requirements/slack-sdk.txt index 7a1b8ca30..47399852e 100644 --- a/requirements/slack-sdk.txt +++ b/requirements/slack-sdk.txt @@ -22,7 +22,7 @@ frozenlist==1.5.0 # via # aiohttp # aiosignal -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) idna==3.10 # via yarl diff --git a/requirements/socket.txt b/requirements/socket.txt index 70615211a..1ceeac99d 100644 --- a/requirements/socket.txt +++ b/requirements/socket.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/sqlalchemy-polars.txt b/requirements/sqlalchemy-polars.txt index 072174c44..c2389aafa 100644 --- a/requirements/sqlalchemy-polars.txt +++ b/requirements/sqlalchemy-polars.txt @@ -16,7 +16,7 @@ execnet==2.1.1 # via pytest-xdist greenlet==3.1.1 # via dycw-utilities (pyproject.toml) -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest @@ -59,7 +59,7 @@ pytest-xdist==3.6.1 # via dycw-utilities (pyproject.toml) sortedcontainers==2.4.0 # via hypothesis -sqlalchemy==2.0.36 +sqlalchemy==2.0.37 # via dycw-utilities (pyproject.toml) tenacity==9.0.0 # via dycw-utilities (pyproject.toml) diff --git a/requirements/sqlalchemy.txt b/requirements/sqlalchemy.txt index bc2ee048e..889e3fbd9 100644 --- a/requirements/sqlalchemy.txt +++ b/requirements/sqlalchemy.txt @@ -16,7 +16,7 @@ execnet==2.1.1 # via pytest-xdist greenlet==3.1.1 # via dycw-utilities (pyproject.toml) -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest @@ -57,7 +57,7 @@ pytest-xdist==3.6.1 # via dycw-utilities (pyproject.toml) sortedcontainers==2.4.0 # via hypothesis -sqlalchemy==2.0.36 +sqlalchemy==2.0.37 # via dycw-utilities (pyproject.toml) tenacity==9.0.0 # via dycw-utilities (pyproject.toml) diff --git a/requirements/streamlit.txt b/requirements/streamlit.txt index 13f404c97..53c2e62d2 100644 --- a/requirements/streamlit.txt +++ b/requirements/streamlit.txt @@ -29,7 +29,7 @@ gitdb==4.0.12 # via gitpython gitpython==3.1.44 # via streamlit -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) idna==3.10 # via requests diff --git a/requirements/sys.txt b/requirements/sys.txt index baf218800..e0166b3a7 100644 --- a/requirements/sys.txt +++ b/requirements/sys.txt @@ -40,7 +40,7 @@ httpx==0.28.1 # via hatch hyperlink==21.0.0 # via hatch -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) idna==3.10 # via diff --git a/requirements/tempfile.txt b/requirements/tempfile.txt index e70c2a0bc..aa0c1ecd9 100644 --- a/requirements/tempfile.txt +++ b/requirements/tempfile.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/tenacity.txt b/requirements/tenacity.txt index a5296decf..f9dce9a00 100644 --- a/requirements/tenacity.txt +++ b/requirements/tenacity.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/text.txt b/requirements/text.txt index 4d110bee1..b0fcb936a 100644 --- a/requirements/text.txt +++ b/requirements/text.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/threading.txt b/requirements/threading.txt index f322fd8be..0856a2eb1 100644 --- a/requirements/threading.txt +++ b/requirements/threading.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/timer.txt b/requirements/timer.txt index dae83ebf8..6ca26fa21 100644 --- a/requirements/timer.txt +++ b/requirements/timer.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/traceback.txt b/requirements/traceback.txt index 5c2ea5cfe..e56beda9b 100644 --- a/requirements/traceback.txt +++ b/requirements/traceback.txt @@ -40,7 +40,7 @@ httpx==0.28.1 # via hatch hyperlink==21.0.0 # via hatch -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) idna==3.10 # via diff --git a/requirements/treelib.txt b/requirements/treelib.txt index 31a5d8347..3c289906d 100644 --- a/requirements/treelib.txt +++ b/requirements/treelib.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/types.txt b/requirements/types.txt index 3a2baae11..8ad1e4f1e 100644 --- a/requirements/types.txt +++ b/requirements/types.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/typing.txt b/requirements/typing.txt index 84dbe6300..1f4b58181 100644 --- a/requirements/typing.txt +++ b/requirements/typing.txt @@ -14,7 +14,7 @@ eventkit==1.0.3 # via ib-async-dataclass execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) ib-async-dataclass==1.0.3rc5 # via dycw-utilities (pyproject.toml) diff --git a/requirements/uuid.txt b/requirements/uuid.txt index da0d4681b..95b5f5a2b 100644 --- a/requirements/uuid.txt +++ b/requirements/uuid.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/version.txt b/requirements/version.txt index 2743a05b0..bfb59eae9 100644 --- a/requirements/version.txt +++ b/requirements/version.txt @@ -38,7 +38,7 @@ httpx==0.28.1 # via hatch hyperlink==21.0.0 # via hatch -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) idna==3.10 # via diff --git a/requirements/warnings.txt b/requirements/warnings.txt index 107e67dbd..5456cb832 100644 --- a/requirements/warnings.txt +++ b/requirements/warnings.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/whenever.txt b/requirements/whenever.txt index e946202c7..3b6fd2de3 100644 --- a/requirements/whenever.txt +++ b/requirements/whenever.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/zipfile.txt b/requirements/zipfile.txt index 0a1f4ae7c..3b009e6ee 100644 --- a/requirements/zipfile.txt +++ b/requirements/zipfile.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/requirements/zoneinfo.txt b/requirements/zoneinfo.txt index f109a9326..b4863acd6 100644 --- a/requirements/zoneinfo.txt +++ b/requirements/zoneinfo.txt @@ -10,7 +10,7 @@ coverage-conditional-plugin==0.9.0 # via dycw-utilities (pyproject.toml) execnet==2.1.1 # via pytest-xdist -hypothesis==6.123.11 +hypothesis==6.123.13 # via dycw-utilities (pyproject.toml) iniconfig==2.0.0 # via pytest diff --git a/src/tests/test_dataclasses.py b/src/tests/test_dataclasses.py index 37ef0bfba..dd24ef7dd 100644 --- a/src/tests/test_dataclasses.py +++ b/src/tests/test_dataclasses.py @@ -14,7 +14,7 @@ from pytest import raises from typing_extensions import override -from tests.test_operator import DataClass3 +from tests.test_operator import DataClass5 from utilities.dataclasses import ( YieldFieldsError, _MappingToDataclassCaseInsensitiveNonUniqueError, @@ -28,7 +28,7 @@ yield_fields, ) from utilities.functions import get_class_name -from utilities.hypothesis import text_ascii +from utilities.hypothesis import paths, text_ascii from utilities.iterables import one from utilities.orjson import OrjsonLogRecord from utilities.polars import are_frames_equal @@ -188,6 +188,16 @@ class Example: expected = Example(x=value) assert obj == expected + @given(value=paths()) + def test_path(self, *, value: Path) -> None: + @dataclass(kw_only=True, slots=True) + class Example: + x: Path + + obj = mapping_to_dataclass(Example, {"x": value}) + expected = Example(x=value) + assert obj == expected + @given(value=text_ascii()) def test_post(self, *, value: str) -> None: @dataclass(kw_only=True, slots=True) @@ -392,10 +402,26 @@ class Example: assert get_args(arg) == ("true", "false") def test_class_literal_defined_elsewhere(self) -> None: - result = one(yield_fields(DataClass3)) - expected = _YieldFieldsClass( - name="truth", type_=Literal["true", "false"], kw_only=True - ) + result = one(yield_fields(DataClass5)) + expected = _YieldFieldsClass(name="path", type_=Path, kw_only=True) + assert result == expected + + def test_class_path(self) -> None: + @dataclass(kw_only=True, slots=True) + class Example: + x: Path + + result = one(yield_fields(Example)) + expected = _YieldFieldsClass(name="x", type_=Path, kw_only=True) + assert result == expected + + def test_class_path_defined_elsewhere(self) -> None: + @dataclass(kw_only=True, slots=True) + class Example: + x: Path + + result = one(yield_fields(Example)) + expected = _YieldFieldsClass(name="x", type_=Path, kw_only=True) assert result == expected def test_class_orjson_log_record(self) -> None: diff --git a/src/tests/test_hypothesis.py b/src/tests/test_hypothesis.py index 7b63da9ed..1bec7905f 100644 --- a/src/tests/test_hypothesis.py +++ b/src/tests/test_hypothesis.py @@ -28,6 +28,7 @@ uuids, ) from numpy import inf, int64, isfinite, isinf, isnan, ravel, rint +from pathvalidate import validate_filepath from pytest import raises from sqlalchemy import Column, Integer, MetaData, Table, insert, select from sqlalchemy.ext.asyncio import AsyncEngine @@ -69,6 +70,7 @@ months, numbers, pairs, + paths, random_states, sets_fixed_length, settings_with_reduced_examples, @@ -641,6 +643,15 @@ def test_main(self, *, data: DataObject, unique: bool, sorted_: bool) -> None: assert first <= second +class TestPaths: + @given(data=data()) + def test_main(self, *, data: DataObject) -> None: + path = data.draw(paths()) + assert isinstance(path, Path) + assert not path.is_absolute() + validate_filepath(str(path)) + + class TestRandomStates: @given(data=data()) def test_main(self, *, data: DataObject) -> None: diff --git a/src/tests/test_operator.py b/src/tests/test_operator.py index 6972870c0..ce26ce522 100644 --- a/src/tests/test_operator.py +++ b/src/tests/test_operator.py @@ -5,7 +5,6 @@ from enum import Enum, auto from functools import partial from math import nan -from pathlib import Path from typing import TYPE_CHECKING, Any, Literal from hypothesis import example, given @@ -35,6 +34,7 @@ from utilities.hypothesis import ( assume_does_not_raise, int64s, + paths, text_ascii, text_printable, timedeltas_2w, @@ -46,6 +46,8 @@ from utilities.polars import are_frames_equal if TYPE_CHECKING: + from pathlib import Path + from utilities.types import Number from utilities.typing import StrMapping @@ -75,7 +77,7 @@ def base_objects( | dates() | datetimes() | int64s() - | text_ascii().map(Path) + | paths() | text_printable().filter(lambda x: not x.startswith("[")) | times() | timedeltas_2w() @@ -244,6 +246,11 @@ def __hash__(self) -> int: return id(self) +@dataclass(unsafe_hash=True, kw_only=True, slots=True) +class DataClass5: + path: Path + + class TruthEnum(Enum): true = auto() false = auto() diff --git a/src/tests/test_python_dotenv.py b/src/tests/test_python_dotenv.py index c5430d0cd..3258af11d 100644 --- a/src/tests/test_python_dotenv.py +++ b/src/tests/test_python_dotenv.py @@ -11,7 +11,12 @@ from pytest import raises from utilities.errors import ImpossibleCaseError -from utilities.hypothesis import git_repos, settings_with_reduced_examples, text_ascii +from utilities.hypothesis import ( + git_repos, + paths, + settings_with_reduced_examples, + text_ascii, +) from utilities.os import temp_environ from utilities.python_dotenv import ( _LoadSettingsDuplicateKeysError, @@ -215,6 +220,20 @@ class Settings: expected = Settings(key=value) assert settings == expected + @given(root=git_repos(), value=paths()) + @settings_with_reduced_examples() + def test_path_value(self, *, root: Path, value: Path) -> None: + @dataclass(kw_only=True, slots=True) + class Settings: + key: Path + + with root.joinpath(".env").open(mode="w") as fh: + _ = fh.write(f"key = {value}\n") + + settings = load_settings(Settings, cwd=root) + expected = Settings(key=value) + assert settings == expected + @given(root=git_repos()) @settings_with_reduced_examples() def test_error_file_not_found(self, *, root: Path) -> None: diff --git a/src/utilities/__init__.py b/src/utilities/__init__.py index c63d0df98..05213e42d 100644 --- a/src/utilities/__init__.py +++ b/src/utilities/__init__.py @@ -1,3 +1,3 @@ from __future__ import annotations -__version__ = "0.90.12" +__version__ = "0.90.13" diff --git a/src/utilities/dataclasses.py b/src/utilities/dataclasses.py index 107e26a02..9419ac506 100644 --- a/src/utilities/dataclasses.py +++ b/src/utilities/dataclasses.py @@ -1,6 +1,7 @@ from __future__ import annotations from dataclasses import MISSING, dataclass, field, fields, replace +from pathlib import Path from typing import TYPE_CHECKING, Any, Generic, Literal, TypeVar, overload from typing_extensions import override @@ -254,7 +255,11 @@ def yield_fields( kw_only=field.kw_only, ) elif is_dataclass_class(obj): - hints = get_type_hints(obj, globalns=globalns, localns=localns) + hints = get_type_hints( + obj, + globalns=globalns, + localns={"Path": Path} | ({} if localns is None else dict(localns)), + ) for field in fields(obj): if isinstance(field.type, type): type_ = field.type diff --git a/src/utilities/hypothesis.py b/src/utilities/hypothesis.py index cb4b79e59..3f2783c83 100644 --- a/src/utilities/hypothesis.py +++ b/src/utilities/hypothesis.py @@ -600,6 +600,16 @@ def _pairs_map(elements: list[_T], /) -> tuple[_T, _T]: ## +def paths() -> SearchStrategy[Path]: + """Strategy for generating `Path`s.""" + return lists(text_ascii(min_size=1, max_size=10), max_size=10).map( + lambda parts: Path(*parts) + ) + + +## + + @composite def random_states( _draw: DrawFn, /, *, seed: MaybeSearchStrategy[int | None] = None @@ -1128,6 +1138,7 @@ def zoned_datetimes( "months", "numbers", "pairs", + "paths", "random_states", "sets_fixed_length", "setup_hypothesis_profiles", diff --git a/src/utilities/python_dotenv.py b/src/utilities/python_dotenv.py index d965e3551..f691d8569 100644 --- a/src/utilities/python_dotenv.py +++ b/src/utilities/python_dotenv.py @@ -4,6 +4,7 @@ from enum import Enum from functools import partial from os import environ +from pathlib import Path from re import IGNORECASE, search from typing import TYPE_CHECKING, Any, TypeVar @@ -26,7 +27,6 @@ if TYPE_CHECKING: from collections.abc import Mapping - from pathlib import Path from utilities.types import PathLike, StrMapping @@ -91,6 +91,8 @@ def _load_settings_post( raise _LoadSettingsInvalidIntError( path=path, values=values, field=field.name, value=value ) from None + if type_ is Path: + return Path(value) if isinstance(type_, type) and issubclass(type_, Enum): try: return ensure_enum(value, type_)