Add a repr method for ClientOptions (#9849)
diff --git a/google/api_core/client_options.py b/google/api_core/client_options.py
index 1144d2f..137043f 100644
--- a/google/api_core/client_options.py
+++ b/google/api_core/client_options.py
@@ -50,6 +50,9 @@
def __init__(self, api_endpoint=None):
self.api_endpoint = api_endpoint
+ def __repr__(self):
+ return "ClientOptions: " + repr(self.__dict__)
+
def from_dict(options):
"""Construct a client options object from a dictionary.
diff --git a/tests/unit/test_client_options.py b/tests/unit/test_client_options.py
index 14cae9f..952adfc 100644
--- a/tests/unit/test_client_options.py
+++ b/tests/unit/test_client_options.py
@@ -34,3 +34,9 @@
client_options.from_dict(
{"api_endpoint": "foo.googleapis.com", "bad_arg": "1234"}
)
+
+
+def test_repr():
+ options = client_options.ClientOptions(api_endpoint="foo.googleapis.com")
+
+ assert repr(options) == "ClientOptions: {'api_endpoint': 'foo.googleapis.com'}"