File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -256,7 +256,11 @@ async def test_wrap_method_with_overriding_timeout_as_a_number():
256256 result = await wrapped_method (timeout = 22 )
257257
258258 assert result == 42
259- method .assert_called_once_with (timeout = 22 , metadata = mock .ANY )
259+
260+ actual_timeout = method .call_args [1 ]["timeout" ]
261+ metadata = method .call_args [1 ]["metadata" ]
262+ assert metadata == mock .ANY
263+ assert actual_timeout == pytest .approx (22 , abs = 0.01 )
260264
261265
262266@pytest .mark .asyncio
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ async def test_constructor():
8585
8686
8787@pytest .mark .asyncio
88- def test_metadata ():
88+ async def test_metadata ():
8989 expected_metadata = struct_pb2 .Struct ()
9090 future , _ , _ = make_operation_future (
9191 [make_operation_proto (metadata = expected_metadata )]
@@ -178,7 +178,7 @@ async def test_unexpected_result(unused_sleep):
178178
179179
180180@pytest .mark .asyncio
181- def test_from_gapic ():
181+ async def test_from_gapic ():
182182 operation_proto = make_operation_proto (done = True )
183183 operations_client = mock .create_autospec (
184184 operations_v1 .OperationsClient , instance = True
Original file line number Diff line number Diff line change @@ -201,7 +201,11 @@ def test_wrap_method_with_overriding_timeout_as_a_number():
201201 result = wrapped_method (timeout = 22 )
202202
203203 assert result == 42
204- method .assert_called_once_with (timeout = 22 , metadata = mock .ANY )
204+
205+ actual_timeout = method .call_args [1 ]["timeout" ]
206+ metadata = method .call_args [1 ]["metadata" ]
207+ assert metadata == mock .ANY
208+ assert actual_timeout == pytest .approx (22 , abs = 0.01 )
205209
206210
207211def test_wrap_method_with_call ():
You can’t perform that action at this time.
0 commit comments