Skip to content

Commit 934ebd6

Browse files
committed
make format
1 parent 1996dfe commit 934ebd6

File tree

4 files changed

+19
-45
lines changed

4 files changed

+19
-45
lines changed

tests/test_call_model_input_filter_unit.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ async def test_call_model_input_filter_sync_non_streamed_unit() -> None:
2929
type="message",
3030
role="assistant",
3131
content=[
32-
ResponseOutputText(
33-
text="ok", type="output_text", annotations=[], logprobs=[]
34-
)
32+
ResponseOutputText(text="ok", type="output_text", annotations=[], logprobs=[])
3533
],
3634
status="completed",
3735
)
@@ -69,9 +67,7 @@ async def test_call_model_input_filter_async_streamed_unit() -> None:
6967
type="message",
7068
role="assistant",
7169
content=[
72-
ResponseOutputText(
73-
text="ok", type="output_text", annotations=[], logprobs=[]
74-
)
70+
ResponseOutputText(text="ok", type="output_text", annotations=[], logprobs=[])
7571
],
7672
status="completed",
7773
)

tests/test_extension_filters.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ def _get_message_output_run_item(content: str) -> MessageOutputItem:
4343
raw_item=ResponseOutputMessage(
4444
id="1",
4545
content=[
46-
ResponseOutputText(
47-
text=content, annotations=[], type="output_text", logprobs=[]
48-
)
46+
ResponseOutputText(text=content, annotations=[], type="output_text", logprobs=[])
4947
],
5048
role="assistant",
5149
status="completed",

tests/test_items_helpers.py

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,8 @@ def make_message(
5757

5858
def test_extract_last_content_of_text_message() -> None:
5959
# Build a message containing two text segments.
60-
content1 = ResponseOutputText(
61-
annotations=[], text="Hello ", type="output_text", logprobs=[]
62-
)
63-
content2 = ResponseOutputText(
64-
annotations=[], text="world!", type="output_text", logprobs=[]
65-
)
60+
content1 = ResponseOutputText(annotations=[], text="Hello ", type="output_text", logprobs=[])
61+
content2 = ResponseOutputText(annotations=[], text="world!", type="output_text", logprobs=[])
6662
message = make_message([content1, content2])
6763
# Helpers should yield the last segment's text.
6864
assert ItemHelpers.extract_last_content(message) == "world!"
@@ -93,12 +89,8 @@ def test_extract_last_content_non_message_returns_empty() -> None:
9389

9490
def test_extract_last_text_returns_text_only() -> None:
9591
# A message whose last segment is text yields the text.
96-
first_text = ResponseOutputText(
97-
annotations=[], text="part1", type="output_text", logprobs=[]
98-
)
99-
second_text = ResponseOutputText(
100-
annotations=[], text="part2", type="output_text", logprobs=[]
101-
)
92+
first_text = ResponseOutputText(annotations=[], text="part1", type="output_text", logprobs=[])
93+
second_text = ResponseOutputText(annotations=[], text="part2", type="output_text", logprobs=[])
10294
message = make_message([first_text, second_text])
10395
assert ItemHelpers.extract_last_text(message) == "part2"
10496
# Whereas when last content is a refusal, extract_last_text returns None.
@@ -126,13 +118,9 @@ def test_input_to_new_input_list_deep_copies_lists() -> None:
126118
def test_text_message_output_concatenates_text_segments() -> None:
127119
# Build a message with both text and refusal segments, only text segments are concatenated.
128120
pieces: list[ResponseOutputText | ResponseOutputRefusal] = []
129-
pieces.append(
130-
ResponseOutputText(annotations=[], text="a", type="output_text", logprobs=[])
131-
)
121+
pieces.append(ResponseOutputText(annotations=[], text="a", type="output_text", logprobs=[]))
132122
pieces.append(ResponseOutputRefusal(refusal="denied", type="refusal"))
133-
pieces.append(
134-
ResponseOutputText(annotations=[], text="b", type="output_text", logprobs=[])
135-
)
123+
pieces.append(ResponseOutputText(annotations=[], text="b", type="output_text", logprobs=[]))
136124
message = make_message(pieces)
137125
# Wrap into MessageOutputItem to feed into text_message_output.
138126
item = MessageOutputItem(agent=Agent(name="test"), raw_item=message)
@@ -321,14 +309,14 @@ def test_input_to_new_input_list_copies_the_ones_produced_by_pydantic() -> None:
321309
# Given a list of message dictionaries, ensure the returned list is a deep copy.
322310
original = ResponseOutputMessageParam(
323311
id="a75654dc-7492-4d1c-bce0-89e8312fbdd7",
324-
content=[
325-
ResponseOutputTextParam(
326-
type="output_text",
327-
text="Hey, what's up?",
328-
annotations=[],
329-
logprobs=[],
330-
)
331-
],
312+
content=[
313+
ResponseOutputTextParam(
314+
type="output_text",
315+
text="Hey, what's up?",
316+
annotations=[],
317+
logprobs=[],
318+
)
319+
],
332320
role="assistant",
333321
status="completed",
334322
type="message",

tests/test_responses.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@ def get_text_message(content: str) -> ResponseOutputItem:
3131
id="1",
3232
type="message",
3333
role="assistant",
34-
content=[
35-
ResponseOutputText(
36-
text=content, type="output_text", annotations=[], logprobs=[]
37-
)
38-
],
34+
content=[ResponseOutputText(text=content, type="output_text", annotations=[], logprobs=[])],
3935
status="completed",
4036
)
4137

@@ -77,10 +73,6 @@ def get_final_output_message(args: str) -> ResponseOutputItem:
7773
id="1",
7874
type="message",
7975
role="assistant",
80-
content=[
81-
ResponseOutputText(
82-
text=args, type="output_text", annotations=[], logprobs=[]
83-
)
84-
],
76+
content=[ResponseOutputText(text=args, type="output_text", annotations=[], logprobs=[])],
8577
status="completed",
8678
)

0 commit comments

Comments
 (0)