mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-07-31 21:20:23 +08:00
Update pathlib for 3.14 (#14006)
This commit is contained in:
@@ -147,16 +147,6 @@ multiprocessing.process.BaseProcess.interrupt
|
||||
multiprocessing.synchronize.SemLock.locked
|
||||
os.__all__
|
||||
os.readinto
|
||||
pathlib.Path.copy_into
|
||||
pathlib.Path.copytree
|
||||
pathlib.Path.delete
|
||||
pathlib.Path.info
|
||||
pathlib.Path.move
|
||||
pathlib.Path.move_into
|
||||
pathlib.Path.rmtree
|
||||
pathlib.PurePath.is_relative_to
|
||||
pathlib.PurePath.relative_to
|
||||
pathlib.types
|
||||
pdb.__all__
|
||||
pdb.Pdb.__init__
|
||||
pdb.Pdb.checkline
|
||||
|
||||
@@ -4,6 +4,10 @@ import sys
|
||||
from pathlib import Path, PureWindowsPath
|
||||
from typing_extensions import assert_type
|
||||
|
||||
|
||||
class MyCustomPath(Path): ...
|
||||
|
||||
|
||||
if Path("asdf") == Path("asdf"):
|
||||
...
|
||||
|
||||
@@ -23,8 +27,20 @@ if PureWindowsPath("asdf") == Path("asdf"): # type: ignore
|
||||
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
|
||||
class MyCustomPath(Path): ...
|
||||
|
||||
pth = MyCustomPath.from_uri("file:///tmp/abc.txt")
|
||||
assert_type(pth, MyCustomPath)
|
||||
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
pth = MyCustomPath("asdf")
|
||||
# With text path, type should be preserved.
|
||||
assert_type(pth.move_into("asdf"), MyCustomPath)
|
||||
assert_type(pth.move("asdf"), MyCustomPath)
|
||||
assert_type(pth.copy("asdf"), MyCustomPath)
|
||||
assert_type(pth.copy_into("asdf"), MyCustomPath)
|
||||
|
||||
# With an actual path type, that type should be preserved.
|
||||
assert_type(pth.move_into(Path("asdf")), Path)
|
||||
assert_type(pth.move(Path("asdf")), Path)
|
||||
assert_type(pth.copy(Path("asdf")), Path)
|
||||
assert_type(pth.copy_into(Path("asdf")), Path)
|
||||
|
||||
Reference in New Issue
Block a user