[py-svn] r37767 - py/trunk/py/doc
guido at codespeak.net
guido at codespeak.net
Thu Feb 1 21:28:22 CET 2007
Author: guido
Date: Thu Feb 1 21:28:21 2007
New Revision: 37767
Modified:
py/trunk/py/doc/path.txt
Log:
Fixed Windows issues in doctests.
Modified: py/trunk/py/doc/path.txt
==============================================================================
--- py/trunk/py/doc/path.txt (original)
+++ py/trunk/py/doc/path.txt Thu Feb 1 21:28:21 2007
@@ -109,9 +109,9 @@
>>> results = []
>>> for fpath in dirpath.visit('*.txt'):
... if 'bar' in fpath.read():
- ... results.append(fpath.relto(dirpath))
+ ... results.append(fpath.basename)
>>> results
- ['textfile1.txt', 'textfile2.txt', 'subdir/textfile2.txt']
+ ['textfile1.txt', 'textfile2.txt', 'textfile2.txt']
Joining path types
++++++++++++++++++++
@@ -122,9 +122,10 @@
>>> p1 = py.path.local('/foo/bar')
>>> p2 = p1.join('baz/qux')
- >>> p2.strpath
- '/foo/bar/baz/qux'
- >>> p2.relto(p1)
+ >>> p2 == py.path.local('/foo/bar/baz/qux')
+ True
+ >>> sep = py.path.local.sep
+ >>> p2.relto(p1).replace(sep, '/') # os-specific path sep in the string
'baz/qux'
>>> p3 = p1 / 'baz/qux' # the / operator allows joining, too
>>> p2 == p3
More information about the py-svn
mailing list