Skip to content

Commit

Permalink
typesafety: add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-- committed Apr 1, 2024
1 parent 3acd63a commit 8acf527
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def typesafety(session):
session.run(
"python",
"-m", "pytest",
"-v",
"-p", "pytest-mypy-plugins",
"--mypy-pyproject-toml-file", "pyproject.toml",
"typesafety",
Expand Down
34 changes: 33 additions & 1 deletion typesafety/test_upath_interface.yml
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 8acf527

Please sign in to comment.