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

feat: expose extra fields in ExtendedOperation#351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
software-dov merged 2 commits intogoogleapis:mainfromsoftware-dov:exo-getattr
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletionsgoogle/api_core/extended_operation.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,6 +111,9 @@ def error_code(self):
def error_message(self):
return self._extended_operation.error_message

def __getattr__(self, name):
return getattr(self._extended_operation, name)

def done(self, retry=polling.DEFAULT_RETRY):
self._refresh_and_update(retry)
return self._extended_operation.done
Expand Down
21 changes: 21 additions & 0 deletionstests/unit/test_extended_operation.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,6 +37,7 @@ class StatusCode(enum.Enum):
status: StatusCode
error_code: typing.Optional[int] = None
error_message: typing.Optional[str] = None
armor_class: typing.Optional[int] = None

# Note: in generated clients, this property must be generated for each
# extended operation message type.
Expand DownExpand Up@@ -180,3 +181,23 @@ def test_error():

with pytest.raises(exceptions.GoogleAPICallError):
ex_op.result()


def test_pass_through():
responses = [
CustomOperation(
name=TEST_OPERATION_NAME,
status=CustomOperation.StatusCode.PENDING,
armor_class=10,
),
CustomOperation(
name=TEST_OPERATION_NAME,
status=CustomOperation.StatusCode.DONE,
armor_class=20,
),
]
ex_op, _, _ = make_extended_operation(responses)

assert ex_op.armor_class == 10
ex_op.result()
assert ex_op.armor_class == 20

[8]ページ先頭

©2009-2025 Movatter.jp