From 7be1e59e9d75c112f346d2b76dce3dd60e3584a1 Mon Sep 17 00:00:00 2001 From: MF2199 <38331387+mf2199@users.noreply.github.com> Date: Thu, 28 May 2020 12:05:55 -0400 Subject: [PATCH] feat: [CBT-6 helper] Exposing Retry._deadline as a property (#20) * Retry._deadline exposed as a property * feat Retry._deadline exposed as a property * added property test Co-authored-by: q-logic <52290913+q-logic@users.noreply.github.com> Co-authored-by: Christopher Wilcox --- google/api_core/retry.py | 4 ++++ tests/unit/test_retry.py | 1 + 2 files changed, 5 insertions(+) diff --git a/google/api_core/retry.py b/google/api_core/retry.py index a1d1f182..446d43c0 100644 --- a/google/api_core/retry.py +++ b/google/api_core/retry.py @@ -288,6 +288,10 @@ def retry_wrapped_func(*args, **kwargs): return retry_wrapped_func + @property + def deadline(self): + return self._deadline + def with_deadline(self, deadline): """Return a copy of this retry with the given deadline. diff --git a/tests/unit/test_retry.py b/tests/unit/test_retry.py index be0c6880..a0160e90 100644 --- a/tests/unit/test_retry.py +++ b/tests/unit/test_retry.py @@ -162,6 +162,7 @@ def test_constructor_defaults(self): assert retry_._multiplier == 2 assert retry_._deadline == 120 assert retry_._on_error is None + assert retry_.deadline == 120 def test_constructor_options(self): _some_function = mock.Mock()