Skip to content

Commit

Permalink
code style and fix test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robey Pointer committed Apr 14, 2010
1 parent d268594 commit f67cea4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion paramiko/sftp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ def getcwd(self):
"""
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
Expand All @@ -549,6 +549,10 @@ def put(self, localpath, remotepath, callback=None, confirm = True):
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
Expand Down
8 changes: 4 additions & 4 deletions tests/test_sftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,9 +667,10 @@ def test_M_bad_readv(self):
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.*')
Expand All @@ -682,10 +683,9 @@ def test_N_put_without_confirm(self):
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))
Expand Down

0 comments on commit f67cea4

Please sign in to comment.