@@ -27,7 +27,7 @@ def _make_credentials():
2727
2828@pytest .mark .skipif (
2929 sys .version_info < (3 , 10 ),
30- reason = "Async Client requires Python 3.10+ due to google-auth-library asyncio support"
30+ reason = "Async Client requires Python 3.10+ due to google-auth-library asyncio support" ,
3131)
3232class TestAsyncClient :
3333 @staticmethod
@@ -42,15 +42,23 @@ def test_ctor_defaults(self):
4242 credentials = _make_credentials ()
4343
4444 # We mock AsyncJSONConnection to prevent network logic during init
45- with mock .patch ("google.cloud.storage._experimental.asyncio.async_client.AsyncJSONConnection" ) as MockConn :
45+ with mock .patch (
46+ "google.cloud.storage._experimental.asyncio.async_client.AsyncJSONConnection"
47+ ) as MockConn :
4648 client = self ._make_one (project = PROJECT , credentials = credentials )
4749
4850 assert client .project == PROJECT
4951
5052 # It is the instance of the Mock
5153 assert isinstance (client ._json_connection , mock .Mock )
5254 assert client ._json_connection == MockConn .return_value
53- MockConn .assert_called_once_with (client , _async_http = None , credentials = client .credentials , client_info = None , api_endpoint = None )
55+ MockConn .assert_called_once_with (
56+ client ,
57+ _async_http = None ,
58+ credentials = client .credentials ,
59+ client_info = None ,
60+ api_endpoint = None ,
61+ )
5462
5563 # Verify inheritance from BaseClient worked (batch stack, etc)
5664 assert client .current_batch is None
@@ -60,29 +68,42 @@ def test_ctor_mtls_raises_error(self):
6068 credentials = _make_credentials ()
6169
6270 # Simulate environment where mTLS is enabled
63- with mock .patch ("google.cloud.storage.abstracts.base_client.BaseClient._use_client_cert" , new_callable = mock .PropertyMock ) as mock_mtls :
71+ with mock .patch (
72+ "google.cloud.storage.abstracts.base_client.BaseClient._use_client_cert" ,
73+ new_callable = mock .PropertyMock ,
74+ ) as mock_mtls :
6475 mock_mtls .return_value = True
6576
66- with pytest .raises (ValueError , match = "Async Client currently do not support mTLS" ):
77+ with pytest .raises (
78+ ValueError , match = "Async Client currently do not support mTLS"
79+ ):
6780 self ._make_one (credentials = credentials )
6881
6982 def test_ctor_w_async_http_passed (self ):
7083 credentials = _make_credentials ()
7184 async_http = mock .Mock ()
7285
73- with mock .patch ("google.cloud.storage._experimental.asyncio.async_client.AsyncJSONConnection" ) as MockConn :
86+ with mock .patch (
87+ "google.cloud.storage._experimental.asyncio.async_client.AsyncJSONConnection"
88+ ) as MockConn :
7489 client = self ._make_one (
75- project = "PROJECT" ,
76- credentials = credentials ,
77- _async_http = async_http
90+ project = "PROJECT" , credentials = credentials , _async_http = async_http
7891 )
7992
8093 client ._json_connection
81- MockConn .assert_called_once_with (client , _async_http = async_http , credentials = client .credentials , client_info = None , api_endpoint = None )
94+ MockConn .assert_called_once_with (
95+ client ,
96+ _async_http = async_http ,
97+ credentials = client .credentials ,
98+ client_info = None ,
99+ api_endpoint = None ,
100+ )
82101
83102 def test_bucket_not_implemented (self ):
84103 credentials = _make_credentials ()
85- with mock .patch ("google.cloud.storage._experimental.asyncio.async_client.AsyncJSONConnection" ):
104+ with mock .patch (
105+ "google.cloud.storage._experimental.asyncio.async_client.AsyncJSONConnection"
106+ ):
86107 client = self ._make_one (project = "PROJECT" , credentials = credentials )
87108
88109 with pytest .raises (NotImplementedError ):
0 commit comments