Skip to content

Commit 4cb9c28

Browse files
committed
Run black on the tests
1 parent 705572c commit 4cb9c28

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

instrumentation/opentelemetry-instrumentation-asyncpg/tests/test_asyncpg_wrapper.py

+13-9
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,15 @@ def test_duplicated_uninstrumentation(self):
4343
def test_cursor_instrumentation(self):
4444
def assert_wrapped(assert_fnc):
4545
for cls, methods in [
46-
(cursor.Cursor, ("forward", "fetch", "fetchrow")),
47-
(cursor.CursorIterator, ("__anext__", ))
46+
(cursor.Cursor, ("forward", "fetch", "fetchrow")),
47+
(cursor.CursorIterator, ("__anext__",)),
4848
]:
4949
for method_name in methods:
5050
method = getattr(cls, method_name, None)
51-
assert_fnc(isinstance(method, ObjectProxy), f"{method} isinstance {type(method)}")
52-
51+
assert_fnc(
52+
isinstance(method, ObjectProxy),
53+
f"{method} isinstance {type(method)}",
54+
)
5355

5456
assert_wrapped(self.assertFalse)
5557
AsyncPGInstrumentor().instrument()
@@ -58,8 +60,8 @@ def assert_wrapped(assert_fnc):
5860
assert_wrapped(self.assertFalse)
5961

6062
def test_cursor_span_creation(self):
61-
""" Test the cursor wrapper if it creates spans correctly.
62-
"""
63+
"""Test the cursor wrapper if it creates spans correctly."""
64+
6365
# Mock out all interaction with postgres
6466
async def bind_mock(*args, **kwargs):
6567
return []
@@ -84,7 +86,7 @@ async def exec_mock(*args, **kwargs):
8486

8587
# init the cursor and fetch a single record
8688
crs = cursor.Cursor(conn, "SELECT * FROM test", state, [], Record)
87-
asyncio.run(crs._init(1))
89+
asyncio.run(crs._init(1))
8890
asyncio.run(crs.fetch(1))
8991

9092
spans = self.memory_exporter.get_finished_spans()
@@ -93,11 +95,13 @@ async def exec_mock(*args, **kwargs):
9395
self.assertTrue(spans[0].status.is_ok)
9496

9597
# Now test that the StopAsyncIteration of the cursor does not get recorded as an ERROR
96-
crs_iter = cursor.CursorIterator(conn, "SELECT * FROM test", state, [], Record, 1, 1)
98+
crs_iter = cursor.CursorIterator(
99+
conn, "SELECT * FROM test", state, [], Record, 1, 1
100+
)
97101

98102
with pytest.raises(StopAsyncIteration):
99103
asyncio.run(crs_iter.__anext__())
100104

101105
spans = self.memory_exporter.get_finished_spans()
102106
self.assertEqual(len(spans), 2)
103-
self.assertEqual([span.status.is_ok for span in spans], [True, True])
107+
self.assertEqual([span.status.is_ok for span in spans], [True, True])

0 commit comments

Comments
 (0)