mirror of
https://github.com/python/cpython.git
synced 2025-11-09 18:11:38 +00:00
#11072- applying http://bugs.python.org/review/11072/show suggestions
This commit is contained in:
parent
052a899d5a
commit
a55efb3b6f
2 changed files with 15 additions and 12 deletions
|
|
@ -322,13 +322,13 @@ followed by ``lines`` for the text version or ``binary`` for the binary version.
|
||||||
.. method:: FTP.mlsd(path="", facts=[])
|
.. method:: FTP.mlsd(path="", facts=[])
|
||||||
|
|
||||||
List a directory in a standardized format by using MLSD command
|
List a directory in a standardized format by using MLSD command
|
||||||
(:rfc:`3659`). If *path* is omitted the current directory is assumed.
|
(:rfc:`3659`). If *path* is omitted the current directory is assumed.
|
||||||
*facts* is a list of strings representing the type of information desired
|
*facts* is a list of strings representing the type of information desired
|
||||||
(e.g. *["type", "size", "perm"]*). Return a generator object yielding a
|
(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
|
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
|
file name, the second one is a dictionary containing facts about the file
|
||||||
"facts" depending on the server and whether *facts* argument has been
|
name. Content of this dictionary might be limited by the *facts* argument
|
||||||
provided.
|
but server is not guaranteed to return all requested facts.
|
||||||
|
|
||||||
.. versionadded:: 3.3
|
.. versionadded:: 3.3
|
||||||
|
|
||||||
|
|
@ -340,7 +340,7 @@ followed by ``lines`` for the text version or ``binary`` for the binary version.
|
||||||
directory). Multiple arguments can be used to pass non-standard options to
|
directory). Multiple arguments can be used to pass non-standard options to
|
||||||
the ``NLST`` command.
|
the ``NLST`` command.
|
||||||
|
|
||||||
.. deprecated:: 3.3 use :meth:`mlsd` instead
|
.. deprecated:: 3.3 use :meth:`mlsd` instead.
|
||||||
|
|
||||||
|
|
||||||
.. method:: FTP.dir(argument[, ...])
|
.. method:: FTP.dir(argument[, ...])
|
||||||
|
|
@ -352,7 +352,7 @@ followed by ``lines`` for the text version or ``binary`` for the binary version.
|
||||||
as a *callback* function as for :meth:`retrlines`; the default prints to
|
as a *callback* function as for :meth:`retrlines`; the default prints to
|
||||||
``sys.stdout``. This method returns ``None``.
|
``sys.stdout``. This method returns ``None``.
|
||||||
|
|
||||||
.. deprecated:: 3.3 use :meth:`mlsd` instead
|
.. deprecated:: 3.3 use :meth:`mlsd` instead.
|
||||||
|
|
||||||
|
|
||||||
.. method:: FTP.rename(fromname, toname)
|
.. method:: FTP.rename(fromname, toname)
|
||||||
|
|
|
||||||
|
|
@ -586,10 +586,12 @@ def test_mlsd(self):
|
||||||
|
|
||||||
ls = list(self.client.mlsd())
|
ls = list(self.client.mlsd())
|
||||||
for name, facts in ls:
|
for name, facts in ls:
|
||||||
|
self.assertIsInstance(name, str)
|
||||||
|
self.assertIsInstance(facts, dict)
|
||||||
self.assertTrue(name)
|
self.assertTrue(name)
|
||||||
self.assertTrue('type' in facts)
|
self.assertIn('type', facts)
|
||||||
self.assertTrue('perm' in facts)
|
self.assertIn('perm', facts)
|
||||||
self.assertTrue('unique' in facts)
|
self.assertIn('unique', facts)
|
||||||
|
|
||||||
def set_data(data):
|
def set_data(data):
|
||||||
self.server.handler_instance.next_data = data
|
self.server.handler_instance.next_data = data
|
||||||
|
|
@ -626,7 +628,8 @@ def test_entry(line, type=None, perm=None, unique=None, name=None):
|
||||||
# case sensitiveness
|
# case sensitiveness
|
||||||
set_data('Type=type;TyPe=perm;UNIQUE=unique; name\r\n')
|
set_data('Type=type;TyPe=perm;UNIQUE=unique; name\r\n')
|
||||||
_name, facts = next(self.client.mlsd())
|
_name, facts = next(self.client.mlsd())
|
||||||
[self.assertTrue(x.islower()) for x in facts.keys()]
|
for x in facts:
|
||||||
|
self.assertTrue(x.islower())
|
||||||
# no data (directory empty)
|
# no data (directory empty)
|
||||||
set_data('')
|
set_data('')
|
||||||
self.assertRaises(StopIteration, next, self.client.mlsd())
|
self.assertRaises(StopIteration, next, self.client.mlsd())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue