Skip to content

Commit b6cea3c

Browse files
authored
Add a repr method for ClientOptions (#9849)
1 parent 74326f4 commit b6cea3c

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

google/api_core/client_options.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ class ClientOptions(object):
5050
def __init__(self, api_endpoint=None):
5151
self.api_endpoint = api_endpoint
5252

53+
def __repr__(self):
54+
return "ClientOptions: " + repr(self.__dict__)
55+
5356

5457
def from_dict(options):
5558
"""Construct a client options object from a dictionary.

tests/unit/test_client_options.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,9 @@ def test_from_dict_bad_argument():
3434
client_options.from_dict(
3535
{"api_endpoint": "foo.googleapis.com", "bad_arg": "1234"}
3636
)
37+
38+
39+
def test_repr():
40+
options = client_options.ClientOptions(api_endpoint="foo.googleapis.com")
41+
42+
assert repr(options) == "ClientOptions: {'api_endpoint': 'foo.googleapis.com'}"

0 commit comments

Comments
 (0)