Skip to content

Commit

Permalink
black formatting updates
Browse files Browse the repository at this point in the history
  • Loading branch information
motus committed Jul 12, 2024
1 parent 289af50 commit ead96a1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(
{
"storageAccountName",
"storageFileShareName",
}
},
)
self._share_client: Optional[ShareClient] = None

Expand All @@ -67,8 +67,9 @@ def _get_share_client(self) -> ShareClient:
Get the Azure file share client object.
"""
if self._share_client is None:
assert self._parent is not None and isinstance(self._parent, SupportsAuth), \
"Authorization service not provided. Include service-auth.jsonc?"
assert self._parent is not None and isinstance(
self._parent, SupportsAuth
), "Authorization service not provided. Include service-auth.jsonc?"
self._share_client = ShareClient.from_share_url(
AzureFileShareService._SHARE_URL.format(
account_name=self.config["storageAccountName"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ def test_download_file(
local_path = f"{local_folder}/{filename}"

config: dict = {}
with patch.object(
azure_fileshare, "_share_client"
) as mock_share_client, patch.object(
with patch.object(azure_fileshare, "_share_client") as mock_share_client, patch.object(
mock_share_client, "get_file_client"
) as mock_get_file_client, patch.object(
mock_share_client, "get_directory_client"
Expand Down Expand Up @@ -88,9 +86,7 @@ def test_download_folder_non_recursive(
mock_share_client = azure_fileshare._share_client # pylint: disable=protected-access

config: dict = {}
with patch.object(
azure_fileshare, "_share_client"
) as mock_share_client, patch.object(
with patch.object(azure_fileshare, "_share_client") as mock_share_client, patch.object(
mock_share_client, "get_directory_client"
) as mock_get_directory_client, patch.object(
mock_share_client, "get_file_client"
Expand Down Expand Up @@ -123,9 +119,7 @@ def test_download_folder_recursive(
local_folder = "some/local/folder"
dir_client_returns = make_dir_client_returns(remote_folder)
config: dict = {}
with patch.object(
azure_fileshare, "_share_client"
) as mock_share_client, patch.object(
with patch.object(azure_fileshare, "_share_client") as mock_share_client, patch.object(
mock_share_client, "get_directory_client"
) as mock_get_directory_client, patch.object(
mock_share_client, "get_file_client"
Expand Down Expand Up @@ -167,8 +161,9 @@ def test_upload_file(
mock_isdir.return_value = False

config: dict = {}
with patch.object(azure_fileshare, "_share_client") as mock_share_client, \
patch.object(mock_share_client, "get_file_client") as mock_get_file_client:
with patch.object(azure_fileshare, "_share_client") as mock_share_client, patch.object(
mock_share_client, "get_file_client"
) as mock_get_file_client:
azure_fileshare.upload(config, local_path, remote_path)

mock_get_file_client.assert_called_with(remote_path)
Expand Down Expand Up @@ -240,8 +235,9 @@ def test_upload_directory_non_recursive(
config: dict = {}

config: dict = {}
with patch.object(azure_fileshare, "_share_client") as mock_share_client, \
patch.object(mock_share_client, "get_file_client") as mock_get_file_client:
with patch.object(azure_fileshare, "_share_client") as mock_share_client, patch.object(
mock_share_client, "get_file_client"
) as mock_get_file_client:
azure_fileshare.upload(config, local_folder, remote_folder, recursive=False)

mock_get_file_client.assert_called_with(f"{remote_folder}/a_file_1.csv")
Expand All @@ -266,8 +262,9 @@ def test_upload_directory_recursive(
config: dict = {}

config: dict = {}
with patch.object(azure_fileshare, "_share_client") as mock_share_client, \
patch.object(mock_share_client, "get_file_client") as mock_get_file_client:
with patch.object(azure_fileshare, "_share_client") as mock_share_client, patch.object(
mock_share_client, "get_file_client"
) as mock_get_file_client:
azure_fileshare.upload(config, local_folder, remote_folder, recursive=True)

mock_get_file_client.assert_has_calls(
Expand Down

0 comments on commit ead96a1

Please sign in to comment.