@@ -32,6 +32,27 @@ def _utcnow_monotonic():
3232 curr_value += delta
3333
3434
35+ def test__determine_timeout ():
36+ # Check _determine_timeout always returns a Timeout object.
37+ timeout_type_timeout = timeout .ConstantTimeout (600.0 )
38+ returned_timeout = google .api_core .gapic_v1 .method ._determine_timeout (
39+ 600.0 , 600.0 , None
40+ )
41+ assert isinstance (returned_timeout , timeout .ConstantTimeout )
42+ returned_timeout = google .api_core .gapic_v1 .method ._determine_timeout (
43+ 600.0 , timeout_type_timeout , None
44+ )
45+ assert isinstance (returned_timeout , timeout .ConstantTimeout )
46+ returned_timeout = google .api_core .gapic_v1 .method ._determine_timeout (
47+ timeout_type_timeout , 600.0 , None
48+ )
49+ assert isinstance (returned_timeout , timeout .ConstantTimeout )
50+ returned_timeout = google .api_core .gapic_v1 .method ._determine_timeout (
51+ timeout_type_timeout , timeout_type_timeout , None
52+ )
53+ assert isinstance (returned_timeout , timeout .ConstantTimeout )
54+
55+
3556def test_wrap_method_basic ():
3657 method = mock .Mock (spec = ["__call__" ], return_value = 42 )
3758
@@ -154,7 +175,8 @@ def test_wrap_method_with_default_retry_and_timeout_using_sentinel(unusued_sleep
154175
155176@mock .patch ("time.sleep" )
156177def test_wrap_method_with_overriding_retry_and_timeout (unusued_sleep ):
157- method = mock .Mock (spec = ["__call__" ], side_effect = [exceptions .NotFound (None ), 42 ])
178+ method = mock .Mock (spec = ["__call__" ], side_effect = [
179+ exceptions .NotFound (None ), 42 ])
158180 default_retry = retry .Retry ()
159181 default_timeout = timeout .ConstantTimeout (60 )
160182 wrapped_method = google .api_core .gapic_v1 .method .wrap_method (
0 commit comments