Skip to content

Commit 0ddc644

Browse files
committed
Reformat with ruff.
1 parent e7eb450 commit 0ddc644

File tree

2 files changed

+34
-11
lines changed
  • instrumentation-genai/opentelemetry-instrumentation-google-genai/tests/generate_content

2 files changed

+34
-11
lines changed

instrumentation-genai/opentelemetry-instrumentation-google-genai/tests/generate_content/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ async def _internal_generator():
5858
return _wrapped
5959

6060

61-
6261
class TestCase(CommonTestCaseBase):
6362
# The "setUp" function is defined by "unittest.TestCase" and thus
6463
# this name must be used. Uncertain why pylint doesn't seem to

instrumentation-genai/opentelemetry-instrumentation-google-genai/tests/generate_content/test_e2e.py

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
output is the purview of the other tests in this directory."""
2525

2626
import asyncio
27+
import gzip
2728
import json
2829
import os
2930
import subprocess
3031

31-
import gzip
3232
import google.auth
3333
import google.auth.credentials
3434
import google.genai
@@ -58,7 +58,10 @@ def _get_project_from_env():
5858
def _get_project_from_gcloud_cli():
5959
try:
6060
gcloud_call_result = subprocess.run(
61-
"gcloud config get project", shell=True, capture_output=True, check=True
61+
"gcloud config get project",
62+
shell=True,
63+
capture_output=True,
64+
check=True,
6265
)
6366
except subprocess.CalledProcessError:
6467
return None
@@ -193,7 +196,9 @@ def _literal_block_scalar_presenter(dumper, data):
193196
return dumper.represent_scalar("tag:yaml.org,2002:str", data, style="|")
194197

195198

196-
@pytest.fixture(name="internal_setup_yaml_pretty_formatting", scope="module", autouse=True)
199+
@pytest.fixture(
200+
name="internal_setup_yaml_pretty_formatting", scope="module", autouse=True
201+
)
197202
def fixture_setup_yaml_pretty_formatting():
198203
yaml.add_representer(_LiteralBlockScalar, _literal_block_scalar_presenter)
199204

@@ -251,13 +256,24 @@ def _ensure_casette_gzip(loaded_casette):
251256
for interaction in loaded_casette["interactions"]:
252257
response = interaction["response"]
253258
headers = response["headers"]
254-
if "content-encoding" not in headers and "Content-Encoding" not in headers:
259+
if (
260+
"content-encoding" not in headers
261+
and "Content-Encoding" not in headers
262+
):
255263
continue
256-
if "content-encoding" in headers and "gzip" not in headers["content-encoding"]:
264+
if (
265+
"content-encoding" in headers
266+
and "gzip" not in headers["content-encoding"]
267+
):
257268
continue
258-
if "Content-Encoding" in headers and "gzip" not in headers["Content-Encoding"]:
269+
if (
270+
"Content-Encoding" in headers
271+
and "gzip" not in headers["Content-Encoding"]
272+
):
259273
continue
260-
response["body"]["string"] = _ensure_gzip_single_response(response["body"]["string"].encode())
274+
response["body"]["string"] = _ensure_gzip_single_response(
275+
response["body"]["string"].encode()
276+
)
261277

262278

263279
class _PrettyPrintJSONBody:
@@ -304,7 +320,11 @@ def fixture_otel_mocker():
304320
result.uninstall()
305321

306322

307-
@pytest.fixture(name="setup_content_recording", autouse=True, params=["logcontent", "excludecontent"])
323+
@pytest.fixture(
324+
name="setup_content_recording",
325+
autouse=True,
326+
params=["logcontent", "excludecontent"],
327+
)
308328
def fixture_setup_content_recording(request):
309329
enabled = request.param == "logcontent"
310330
os.environ["OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT"] = str(
@@ -372,7 +392,9 @@ def _factory():
372392

373393

374394
@pytest.fixture(name="vertex_client_factory")
375-
def fixture_vertex_client_factory(gcloud_project, gcloud_location, gcloud_credentials):
395+
def fixture_vertex_client_factory(
396+
gcloud_project, gcloud_location, gcloud_credentials
397+
):
376398
def _factory():
377399
return google.genai.Client(
378400
vertexai=True,
@@ -397,7 +419,9 @@ def fixture_use_vertex(genai_sdk_backend):
397419

398420

399421
@pytest.fixture(name="client")
400-
def fixture_client(vertex_client_factory, nonvertex_client_factory, use_vertex):
422+
def fixture_client(
423+
vertex_client_factory, nonvertex_client_factory, use_vertex
424+
):
401425
if use_vertex:
402426
return vertex_client_factory()
403427
return nonvertex_client_factory()

0 commit comments

Comments
 (0)