From 8acf527dcc71a25d3b9ad1317ba3d2f95882ccee Mon Sep 17 00:00:00 2001 From: Andreas Poehlmann Date: Mon, 1 Apr 2024 11:50:22 +0200 Subject: [PATCH] typesafety: add more tests --- noxfile.py | 1 + typesafety/test_upath_interface.yml | 34 ++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 9c5056f4..74ebd6ba 100644 --- a/noxfile.py +++ b/noxfile.py @@ -97,6 +97,7 @@ def typesafety(session): session.run( "python", "-m", "pytest", + "-v", "-p", "pytest-mypy-plugins", "--mypy-pyproject-toml-file", "pyproject.toml", "typesafety", diff --git a/typesafety/test_upath_interface.yml b/typesafety/test_upath_interface.yml index 39dd79d4..3428f374 100644 --- a/typesafety/test_upath_interface.yml +++ b/typesafety/test_upath_interface.yml @@ -1,6 +1,38 @@ -- case: upath_interface +- case: upath_new disable_cache: true main: | from upath import UPath reveal_type(UPath("abc")) # N: Revealed type is "upath.core.UPath" +- case: upath_joinpath + disable_cache: true + main: | + from upath import UPath + + reveal_type(UPath("abc").joinpath("efg")) # N: Revealed type is "upath.core.UPath" +- case: upath_truediv + disable_cache: true + main: | + from upath import UPath + + a = UPath("abc") / "efg" + reveal_type(a) # N: Revealed type is "upath.core.UPath" +- case: upath_rtruediv + disable_cache: true + main: | + from upath import UPath + + a = "efg" / UPath("abc") + reveal_type(a) # N: Revealed type is "upath.core.UPath" +- case: upath_as_uri + disable_cache: true + main: | + from upath import UPath + + reveal_type(UPath("a").as_uri()) # N: Revealed type is "builtins.str" +- case: upath_as_posix + disable_cache: true + main: | + from upath import UPath + + reveal_type(UPath("a").as_posix()) # N: Revealed type is "builtins.str"