Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgross committed Feb 20, 2020
1 parent ccea6a7 commit ec3d841
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/pcloud/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ def uploadfile(self, **kwargs):
files = {filename: open(f, "rb")}
# kwargs['filename'] = filename
else: # 'data' in kwargs:
files = {"f": (kwargs.pop("filename", "data-upload.bin"), kwargs.pop("data"))}
files = {
"f": (kwargs.pop("filename", "data-upload.bin"), kwargs.pop("data"))
}
return self._upload("uploadfile", files, **kwargs)

@RequiredParameterCheck(("progresshash",))
Expand Down Expand Up @@ -218,7 +220,7 @@ def file_truncate(self, **kwargs):

@RequiredParameterCheck(("fd", "data"))
def file_write(self, **kwargs):
files = {"file": ('upload-file.io', BytesIO(kwargs.pop("data")))}
files = {"file": ("upload-file.io", BytesIO(kwargs.pop("data")))}
return self._upload("file_write", files, **kwargs)

@RequiredParameterCheck(("fd",))
Expand Down
1 change: 0 additions & 1 deletion src/pcloud/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ def start_mock_server():
httpd_thread.join(1)
httpd_thread._is_stopped = True
httpd_thread._tstate_lock = None

2 changes: 1 addition & 1 deletion src/pcloud/tests/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def do_POST(self):
self.send_response(200)
self.send_header("Content-type", "applicaton/json")
self.end_headers()
print(f"File: {file_}, Size: {size}", end='')
print(f"File: {file_}, Size: {size}", end="")
# Send the json message
self.wfile.write(
bytes('{ "result": 0, "metadata": {"size": %s} }' % size, "utf-8")
Expand Down
3 changes: 0 additions & 3 deletions src/pcloud/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class DummyPCloudFS(PCloudFS):

@pytest.mark.usefixtures("start_mock_server")
class TestPcloudApi(object):

def test_getdigest(self):
api = DummyPyCloud("foo", "bar")
assert api.getdigest() == b"YGtAxbUpI85Zvs7lC7Z62rBwv907TBXhV2L867Hkh"
Expand All @@ -38,12 +37,10 @@ def test_upload_files(self):

@pytest.mark.usefixtures("start_mock_server")
class TestPcloudFs(object):

def test_write(self, capsys):
with DummyPCloudFS(username="foo", password="bar") as fs:
data = b"hello pcloud fs unittest"
fs_f = fs.openbin("hello.bin")
fs_f.write(data)
captured = capsys.readouterr()
assert captured.out == "File: b'hello pcloud fs unittest', Size: 24"

0 comments on commit ec3d841

Please sign in to comment.