Skip to content

Commit fb282a2

Browse files
ruff
Signed-off-by: Adrian Cole <[email protected]>
1 parent e744ca7 commit fb282a2

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

instrumentation/opentelemetry-instrumentation-openai-v2/tests/conftest.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import json
44
import os
5-
import yaml
65

76
import pytest
7+
import yaml
88
from openai import OpenAI
99

1010
from opentelemetry.instrumentation.openai_v2 import OpenAIInstrumentor
@@ -152,7 +152,9 @@ class PrettyPrintJSONBody:
152152
@staticmethod
153153
def serialize(cassette_dict):
154154
cassette_dict = convert_body_to_literal(cassette_dict)
155-
return yaml.dump(cassette_dict, default_flow_style=False, allow_unicode=True)
155+
return yaml.dump(
156+
cassette_dict, default_flow_style=False, allow_unicode=True
157+
)
156158

157159
@staticmethod
158160
def deserialize(cassette_string):
@@ -164,6 +166,7 @@ def fixture_vcr(vcr):
164166
vcr.register_serializer("yaml", PrettyPrintJSONBody)
165167
return vcr
166168

169+
167170
def scrub_response_headers(response):
168171
"""
169172
This scrubs sensitive response headers. Note they are case-sensitive!

instrumentation/opentelemetry-instrumentation-openai-v2/tests/test_chat_completions.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from typing import Optional
1717

1818
import pytest
19-
from openai import (OpenAI, APIConnectionError, NotFoundError)
19+
from openai import APIConnectionError, NotFoundError, OpenAI
2020
from openai.resources.chat.completions import ChatCompletion
2121

2222
from opentelemetry.sdk.trace import ReadableSpan
@@ -85,7 +85,9 @@ def test_chat_completion_bad_endpoint(span_exporter, instrument_no_content):
8585
spans[0], llm_model_value, server_address="localhost"
8686
)
8787
assert 4242 == spans[0].attributes[ServerAttributes.SERVER_PORT]
88-
assert "APIConnectionError" == spans[0].attributes[ErrorAttributes.ERROR_TYPE]
88+
assert (
89+
"APIConnectionError" == spans[0].attributes[ErrorAttributes.ERROR_TYPE]
90+
)
8991

9092

9193
@pytest.mark.vcr()

0 commit comments

Comments
 (0)