diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2018-09-17 18:33:49 -0700 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2018-09-17 18:33:49 -0700 |
commit | dc82971c1af0d147433c948dc440ffabdc276a7c (patch) | |
tree | 3bcf9317a71da26653cb614a9d7beb755d0f3cea /tests/test_sftp.py | |
parent | 008ac2bfb2f886346ba17bd8f47e92fa8b436a3c (diff) |
Blacken, 2.2 edition
Diffstat (limited to 'tests/test_sftp.py')
-rw-r--r-- | tests/test_sftp.py | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/tests/test_sftp.py b/tests/test_sftp.py index a86fca5d..87c57340 100644 --- a/tests/test_sftp.py +++ b/tests/test_sftp.py @@ -189,35 +189,36 @@ class TestSFTP(object): """Test posix-rename@openssh.com protocol extension.""" try: # first check that the normal rename works as specified - with sftp.open(sftp.FOLDER + '/a', 'w') as f: - f.write('one') - sftp.rename(sftp.FOLDER + '/a', sftp.FOLDER + '/b') - with sftp.open(sftp.FOLDER + '/a', 'w') as f: - f.write('two') + with sftp.open(sftp.FOLDER + "/a", "w") as f: + f.write("one") + sftp.rename(sftp.FOLDER + "/a", sftp.FOLDER + "/b") + with sftp.open(sftp.FOLDER + "/a", "w") as f: + f.write("two") try: - sftp.rename(sftp.FOLDER + '/a', sftp.FOLDER + '/b') - self.assertTrue(False, 'no exception when rename-ing onto existing file') + sftp.rename(sftp.FOLDER + "/a", sftp.FOLDER + "/b") + self.assertTrue( + False, "no exception when rename-ing onto existing file" + ) except (OSError, IOError): pass # now check with the posix_rename - sftp.posix_rename(sftp.FOLDER + '/a', sftp.FOLDER + '/b') - with sftp.open(sftp.FOLDER + '/b', 'r') as f: + sftp.posix_rename(sftp.FOLDER + "/a", sftp.FOLDER + "/b") + with sftp.open(sftp.FOLDER + "/b", "r") as f: data = u(f.read()) err = "Contents of renamed file not the same as original file" assert data == "two", err finally: try: - sftp.remove(sftp.FOLDER + '/a') + sftp.remove(sftp.FOLDER + "/a") except: pass try: - sftp.remove(sftp.FOLDER + '/b') + sftp.remove(sftp.FOLDER + "/b") except: pass - def test_6_folder(self, sftp): """ create a temporary folder, verify that we can create a file in it, then |