cpython: 153bd8fc22c7 (original) (raw)
Mercurial > cpython
changeset 69904:153bd8fc22c7
#11072- applying http://bugs.python.org/review/11072/show suggestions [#11072]
Giampaolo Rodola' g.rodola@gmail.com | |
---|---|
date | Sat, 07 May 2011 16:06:59 +0200 |
parents | 5cde01c8003c |
children | 038bb7ac7c4e d2a41b2ae432 |
files | Doc/library/ftplib.rst Lib/test/test_ftplib.py |
diffstat | 2 files changed, 15 insertions(+), 12 deletions(-)[+] [-] Doc/library/ftplib.rst 16 Lib/test/test_ftplib.py 11 |
line wrap: on
line diff
--- a/Doc/library/ftplib.rst
+++ b/Doc/library/ftplib.rst
@@ -322,13 +322,13 @@ followed by lines
for the text versi
.. method:: FTP.mlsd(path="", facts=[])
List a directory in a standardized format by using MLSD command
- (:rfc:
3659
). If path is omitted the current directory is assumed. facts is a list of strings representing the type of information desired
- (e.g. ["type", "size", "perm"]). Return a generator object yielding a
- tuple of two elements for every file found in path. First element is the
- file name, the second one is a dictionary including a variable number of
- "facts" depending on the server and whether facts argument has been
- provided.
- (e.g.
["type", "size", "perm"]
). Return a generator object yielding a - tuple of two elements for every file found in path. First element is the
- file name, the second one is a dictionary containing facts about the file
- name. Content of this dictionary might be limited by the facts argument
- but server is not guaranteed to return all requested facts. .. versionadded:: 3.3
@@ -340,7 +340,7 @@ followed by lines
for the text versi
directory). Multiple arguments can be used to pass non-standard options to
the NLST
command.
.. method:: FTP.dir(argument[, ...])
@@ -352,7 +352,7 @@ followed by lines
for the text versi
as a callback function as for :meth:retrlines
; the default prints to
sys.stdout
. This method returns None
.
.. method:: FTP.rename(fromname, toname)
--- a/Lib/test/test_ftplib.py +++ b/Lib/test/test_ftplib.py @@ -586,10 +586,12 @@ class TestFTPClass(TestCase): ls = list(self.client.mlsd()) for name, facts in ls:
self.assertIsInstance(name, str)[](#l2.7)
self.assertIsInstance(facts, dict)[](#l2.8) self.assertTrue(name)[](#l2.9)
self.assertTrue('type' in facts)[](#l2.10)
self.assertTrue('perm' in facts)[](#l2.11)
self.assertTrue('unique' in facts)[](#l2.12)
self.assertIn('type', facts)[](#l2.13)
self.assertIn('perm', facts)[](#l2.14)
self.assertIn('unique', facts)[](#l2.15)
def set_data(data): self.server.handler_instance.next_data = data @@ -626,7 +628,8 @@ class TestFTPClass(TestCase): # case sensitiveness set_data('Type=type;TyPe=perm;UNIQUE=unique; name\r\n') _name, facts = next(self.client.mlsd())
[self.assertTrue(x.islower()) for x in facts.keys()][](#l2.23)
for x in facts:[](#l2.24)
self.assertTrue(x.islower())[](#l2.25) # no data (directory empty)[](#l2.26) set_data('')[](#l2.27) self.assertRaises(StopIteration, next, self.client.mlsd())[](#l2.28)