From f67cea44d07414806b37905bd58c589d6a48a0df Mon Sep 17 00:00:00 2001 From: Robey Pointer Date: Tue, 13 Apr 2010 18:52:29 -0700 Subject: [PATCH] code style and fix test. --- paramiko/sftp_client.py | 6 +++++- tests/test_sftp.py | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/paramiko/sftp_client.py b/paramiko/sftp_client.py index a7e9058..79a7761 100644 --- a/paramiko/sftp_client.py +++ b/paramiko/sftp_client.py @@ -533,7 +533,7 @@ class SFTPClient (BaseSFTP): """ return self._cwd - def put(self, localpath, remotepath, callback=None, confirm = True): + def put(self, localpath, remotepath, callback=None, confirm=True): """ Copy a local file (C{localpath}) to the SFTP server as C{remotepath}. Any exception raised by operations will be passed through. This @@ -549,6 +549,10 @@ class SFTPClient (BaseSFTP): transferred so far and the total bytes to be transferred (since 1.7.4) @type callback: function(int, int) + @param confirm: whether to do a stat() on the file afterwards to + confirm the file size (since 1.7.7) + @type confirm: bool + @return: an object containing attributes about the given file (since 1.7.4) @rtype: SFTPAttributes diff --git a/tests/test_sftp.py b/tests/test_sftp.py index f191314..2eadabc 100755 --- a/tests/test_sftp.py +++ b/tests/test_sftp.py @@ -667,9 +667,10 @@ class SFTPTest (unittest.TestCase): f.close() finally: sftp.unlink(FOLDER + '/zero') + def test_N_put_without_confirm(self): """ - verify that get/put work. + verify that get/put work without confirmation. """ import os, warnings warnings.filterwarnings('ignore', 'tempnam.*') @@ -682,10 +683,9 @@ class SFTPTest (unittest.TestCase): saved_progress = [] def progress_callback(x, y): saved_progress.append((x, y)) - res = sftp.put(localname, FOLDER + '/bunny.txt', progress_callback, false) - - self.assertEquals(SFTPAttributes(), res) + res = sftp.put(localname, FOLDER + '/bunny.txt', progress_callback, False) + self.assertEquals(SFTPAttributes().attr, res.attr) f = sftp.open(FOLDER + '/bunny.txt', 'r') self.assertEquals(text, f.read(128))