Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6acb3a9

Browse files
author
Benjamin E. Coe
authored
test: switch to regex rather than asserting against whole object (#497)
Fixes:#449,#492
1 parent5dfb6af commit6acb3a9

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

‎tests/unit/test_client_options.py‎

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
fromreimportmatch
1516
importpytest
1617

1718
fromgoogle.api_coreimportclient_options
@@ -144,10 +145,21 @@ def test_from_dict_bad_argument():
144145

145146

146147
deftest_repr():
147-
options=client_options.ClientOptions(api_endpoint="foo.googleapis.com")
148-
149-
assert (
150-
repr(options)
151-
=="ClientOptions: {'api_endpoint': 'foo.googleapis.com', 'client_cert_source': None, 'client_encrypted_cert_source': None, 'api_key': None}"
152-
or"ClientOptions: {'client_encrypted_cert_source': None, 'client_cert_source': None, 'api_endpoint': 'foo.googleapis.com', 'api_key': None}"
148+
expected_keys=set(
149+
[
150+
"api_endpoint",
151+
"client_cert_source",
152+
"client_encrypted_cert_source",
153+
"quota_project_id",
154+
"credentials_file",
155+
"scopes",
156+
"api_key",
157+
"api_audience",
158+
]
153159
)
160+
options=client_options.ClientOptions(api_endpoint="foo.googleapis.com")
161+
options_repr=repr(options)
162+
options_keys=vars(options).keys()
163+
assertmatch(r"ClientOptions:",options_repr)
164+
assertmatch(r".*'api_endpoint': 'foo.googleapis.com'.*",options_repr)
165+
assertoptions_keys==expected_keys

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp