Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
BWMac committed Aug 30, 2024
1 parent 22d26d1 commit a9ca732
Showing 1 changed file with 26 additions and 28 deletions.
54 changes: 26 additions & 28 deletions tests/unit/synapseclient/core/unit_test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,23 +751,23 @@ async def test_download_md5_mismatch__not_local_file(self, syn: Synapse) -> None
]
)

with (
patch.object(syn._requests_session, "get", side_effect=mock_requests_get),
patch.object(
Synapse, "_generate_headers", side_effect=mock_generate_headers
),
patch.object(
utils, "temp_download_filename", return_value=temp_destination
) as mocked_temp_dest,
patch(
"synapseclient.core.download.download_functions.open",
new_callable=mock_open(),
create=True,
) as mocked_open,
patch.object(os.path, "exists", side_effect=[False, True]) as mocked_exists,
patch.object(shutil, "move") as mocked_move,
patch.object(os, "remove") as mocked_remove,
):
with patch.object(
syn._requests_session, "get", side_effect=mock_requests_get
), patch.object(
Synapse, "_generate_headers", side_effect=mock_generate_headers
), patch.object(
utils, "temp_download_filename", return_value=temp_destination
) as mocked_temp_dest, patch(
"synapseclient.core.download.download_functions.open",
new_callable=mock_open(),
create=True,
) as mocked_open, patch.object(
os.path, "exists", side_effect=[False, True]
) as mocked_exists, patch.object(
shutil, "move"
) as mocked_move, patch.object(
os, "remove"
) as mocked_remove:
# function under test
with pytest.raises(SynapseMd5MismatchError):
await download_from_url(
Expand Down Expand Up @@ -806,17 +806,15 @@ async def test_download_md5_mismatch_local_file(self) -> None:
url = "file:///some/file/path.txt"
destination = os.path.normpath(os.path.expanduser("~/fake/path/filerino.txt"))

with (
patch.object(
utils, "file_url_to_path", return_value=destination
) as mocked_file_url_to_path,
patch.object(
utils,
"md5_for_file_hex",
return_value="Some other incorrect md5",
) as mocked_md5_for_file,
patch("os.remove") as mocked_remove,
):
with patch.object(
utils, "file_url_to_path", return_value=destination
) as mocked_file_url_to_path, patch.object(
utils,
"md5_for_file_hex",
return_value="Some other incorrect md5",
) as mocked_md5_for_file, patch(
"os.remove"
) as mocked_remove:
# function under test
with pytest.raises(SynapseMd5MismatchError):
await download_from_url(
Expand Down

0 comments on commit a9ca732

Please sign in to comment.