File tree Expand file tree Collapse file tree 2 files changed +6
-41
lines changed
google/generativeai/types Expand file tree Collapse file tree 2 files changed +6
-41
lines changed Original file line number Diff line number Diff line change @@ -555,7 +555,8 @@ def __str__(self) -> str:
555
555
_result = _result .replace ("\n " , "\n " )
556
556
557
557
if self ._error :
558
- _error = f",\n error=<{ self ._error .__class__ .__name__ } > { self ._error } "
558
+
559
+ _error = f",\n error={ repr (self ._error )} "
559
560
else :
560
561
_error = ""
561
562
Original file line number Diff line number Diff line change @@ -998,10 +998,10 @@ def test_repr_error_info_for_stream_prompt_feedback_blocked(self):
998
998
}
999
999
}),
1000
1000
),
1001
- error=< BlockedPromptException> prompt_feedback {
1001
+ error=BlockedPromptException( prompt_feedback {
1002
1002
block_reason: SAFETY
1003
1003
}
1004
- """
1004
+ ) """
1005
1005
)
1006
1006
self .assertEqual (expected , result )
1007
1007
@@ -1060,7 +1060,7 @@ def no_throw():
1060
1060
"usage_metadata": {}
1061
1061
}),
1062
1062
),
1063
- error=< ValueError> """
1063
+ error=ValueError() """
1064
1064
)
1065
1065
self .assertEqual (expected , result )
1066
1066
@@ -1095,43 +1095,7 @@ def test_repr_error_info_for_chat_streaming_unexpected_stop(self):
1095
1095
response = chat .send_message ("hello2" , stream = True )
1096
1096
1097
1097
result = repr (response )
1098
- expected = textwrap .dedent (
1099
- """\
1100
- response:
1101
- GenerateContentResponse(
1102
- done=True,
1103
- iterator=None,
1104
- result=protos.GenerateContentResponse({
1105
- "candidates": [
1106
- {
1107
- "content": {
1108
- "parts": [
1109
- {
1110
- "text": "abc"
1111
- }
1112
- ]
1113
- },
1114
- "finish_reason": "SAFETY",
1115
- "index": 0,
1116
- "citation_metadata": {}
1117
- }
1118
- ],
1119
- "prompt_feedback": {},
1120
- "usage_metadata": {}
1121
- }),
1122
- ),
1123
- error=<StopCandidateException> content {
1124
- parts {
1125
- text: "abc"
1126
- }
1127
- }
1128
- finish_reason: SAFETY
1129
- index: 0
1130
- citation_metadata {
1131
- }
1132
- """
1133
- )
1134
- self .assertEqual (expected , result )
1098
+ self .assertIn ("StopCandidateException" , result )
1135
1099
1136
1100
def test_repr_for_multi_turn_chat (self ):
1137
1101
# Multi turn chat
You can’t perform that action at this time.
0 commit comments