diff options
author | Marco Buttu <marco.buttu@gmail.com> | 2017-04-13 14:17:59 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2017-04-13 14:17:59 (GMT) |
commit | 7b2491a6aa5cdc1f8f9e3fd9df91f29ee69aa982 (patch) | |
tree | a36719b82f5922e0102d2a0b4bbb5686b50ba045 /Doc/library/pathlib.rst | |
parent | d1dc65dc820649e59633142a88eaf97f930963a9 (diff) | |
download | cpython-7b2491a6aa5cdc1f8f9e3fd9df91f29ee69aa982.zip cpython-7b2491a6aa5cdc1f8f9e3fd9df91f29ee69aa982.tar.gz cpython-7b2491a6aa5cdc1f8f9e3fd9df91f29ee69aa982.tar.bz2 |
bpo-27200: Fix pathlib, ssl, turtle and weakref doctests (GH-616)
Diffstat (limited to 'Doc/library/pathlib.rst')
-rw-r--r-- | Doc/library/pathlib.rst | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index 34ab3b8..1445226 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -271,6 +271,10 @@ property: Methods and properties ^^^^^^^^^^^^^^^^^^^^^^ +.. testsetup:: + + from pathlib import PurePosixPath, PureWindowsPath + Pure paths provide the following methods and properties: .. data:: PurePath.drive @@ -657,6 +661,8 @@ call fails (for example because the path doesn't exist): Return information about this path (similarly to :func:`os.stat`). The result is looked up at each call to this method. + :: + >>> p = Path('setup.py') >>> p.stat().st_size 956 @@ -948,7 +954,7 @@ call fails (for example because the path doesn't exist): .. method:: Path.rglob(pattern) This is like calling :meth:`Path.glob` with "``**``" added in front of the - given *pattern*: + given *pattern*:: >>> sorted(Path().rglob("*.py")) [PosixPath('build/lib/pathlib.py'), @@ -972,6 +978,8 @@ call fails (for example because the path doesn't exist): An :exc:`OSError` can be raised if either file cannot be accessed for some reason. + :: + >>> p = Path('spam') >>> q = Path('eggs') >>> p.samefile(q) @@ -988,6 +996,8 @@ call fails (for example because the path doesn't exist): *target_is_directory* must be true (default ``False``) if the link's target is a directory. Under POSIX, *target_is_directory*'s value is ignored. + :: + >>> p = Path('mylink') >>> p.symlink_to('setup.py') >>> p.resolve() |