Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 61f8b85

Browse files
committed
ran blacken
1 parent 7eb83a8 commit 61f8b85

6 files changed

Lines changed: 37 additions & 19 deletions

File tree

tests/unit/data/_async/test__mutate_rows.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ def _make_one(self, *args, **kwargs):
4949
kwargs["attempt_timeout"] = kwargs.pop("attempt_timeout", 0.1)
5050
kwargs["retryable_exceptions"] = kwargs.pop("retryable_exceptions", ())
5151
kwargs["mutation_entries"] = kwargs.pop("mutation_entries", [])
52-
kwargs["metric"] = kwargs.pop("metric", ActiveOperationMetric("MUTATE_ROWS"))
52+
kwargs["metric"] = kwargs.pop(
53+
"metric", ActiveOperationMetric("MUTATE_ROWS")
54+
)
5355
return self._target_class()(*args, **kwargs)
5456

5557
def _make_mutation(self, count=1, size=1):

tests/unit/data/_async/test__read_rows.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,9 @@ async def mock_stream():
273273
table = mock.Mock()
274274
table._request_path = {"table_name": "table_name"}
275275
table.app_profile_id = "app_profile_id"
276-
instance = self._make_one(query, table, 10, 10, ActiveOperationMetric("READ_ROWS"))
276+
instance = self._make_one(
277+
query, table, 10, 10, ActiveOperationMetric("READ_ROWS")
278+
)
277279
assert instance._remaining_count == start_limit
278280
# read emit_num rows
279281
async for val in instance.chunk_stream(awaitable_stream()):
@@ -312,7 +314,9 @@ async def mock_stream():
312314
table = mock.Mock()
313315
table._request_path = {"table_name": "table_name"}
314316
table.app_profile_id = "app_profile_id"
315-
instance = self._make_one(query, table, 10, 10, ActiveOperationMetric("READ_ROWS"))
317+
instance = self._make_one(
318+
query, table, 10, 10, ActiveOperationMetric("READ_ROWS")
319+
)
316320
assert instance._remaining_count == start_limit
317321
with pytest.raises(InvalidChunk) as e:
318322
# read emit_num rows
@@ -338,7 +342,9 @@ async def mock_stream():
338342
with mock.patch.object(
339343
self._get_target_class(), "_read_rows_attempt"
340344
) as mock_attempt:
341-
instance = self._make_one(mock.Mock(), mock.Mock(), 1, 1, ActiveOperationMetric("READ_ROWS"))
345+
instance = self._make_one(
346+
mock.Mock(), mock.Mock(), 1, 1, ActiveOperationMetric("READ_ROWS")
347+
)
342348
wrapped_gen = mock_stream()
343349
mock_attempt.return_value = wrapped_gen
344350
gen = instance.start_operation()

tests/unit/data/_async/test_client.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1957,7 +1957,9 @@ async def test_read_row(self):
19571957
async with self._make_client() as client:
19581958
table = client.get_table("instance", "table")
19591959
row_key = b"test_1"
1960-
with mock.patch.object(CrossSync, "_ReadRowsOperation") as mock_op_constructor:
1960+
with mock.patch.object(
1961+
CrossSync, "_ReadRowsOperation"
1962+
) as mock_op_constructor:
19611963
mock_op = mock.Mock()
19621964
expected_result = object()
19631965

@@ -1996,7 +1998,9 @@ async def test_read_row_w_filter(self):
19961998
async with self._make_client() as client:
19971999
table = client.get_table("instance", "table")
19982000
row_key = b"test_1"
1999-
with mock.patch.object(CrossSync, "_ReadRowsOperation") as mock_op_constructor:
2001+
with mock.patch.object(
2002+
CrossSync, "_ReadRowsOperation"
2003+
) as mock_op_constructor:
20002004
mock_op = mock.Mock()
20012005
expected_result = object()
20022006

@@ -2037,7 +2041,9 @@ async def test_read_row_no_response(self):
20372041
async with self._make_client() as client:
20382042
table = client.get_table("instance", "table")
20392043
row_key = b"test_1"
2040-
with mock.patch.object(CrossSync, "_ReadRowsOperation") as mock_op_constructor:
2044+
with mock.patch.object(
2045+
CrossSync, "_ReadRowsOperation"
2046+
) as mock_op_constructor:
20412047
mock_op = mock.Mock()
20422048

20432049
if CrossSync.is_async:
@@ -2082,7 +2088,9 @@ async def test_row_exists(self, return_value, expected_result):
20822088
async with self._make_client() as client:
20832089
table = client.get_table("instance", "table")
20842090
row_key = b"test_1"
2085-
with mock.patch.object(CrossSync, "_ReadRowsOperation") as mock_op_constructor:
2091+
with mock.patch.object(
2092+
CrossSync, "_ReadRowsOperation"
2093+
) as mock_op_constructor:
20862094
mock_op = mock.Mock()
20872095
if CrossSync.is_async:
20882096

tests/unit/data/_async/test_mutations_batcher.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,9 @@ def _get_target_class(self):
307307
def _make_one(self, table=None, **kwargs):
308308
from google.api_core.exceptions import DeadlineExceeded
309309
from google.api_core.exceptions import ServiceUnavailable
310-
from google.cloud.bigtable.data._metrics import BigtableClientSideMetricsController
310+
from google.cloud.bigtable.data._metrics import (
311+
BigtableClientSideMetricsController,
312+
)
311313

312314
if table is None:
313315
table = mock.Mock()
@@ -1097,7 +1099,9 @@ async def test_timeout_args_passed(self):
10971099
assert instance._operation_timeout == expected_operation_timeout
10981100
assert instance._attempt_timeout == expected_attempt_timeout
10991101
# make simulated gapic call
1100-
await instance._execute_mutate_rows([self._make_mutation()], mock.Mock())
1102+
await instance._execute_mutate_rows(
1103+
[self._make_mutation()], mock.Mock()
1104+
)
11011105
assert mutate_rows.call_count == 1
11021106
kwargs = mutate_rows.call_args[1]
11031107
assert kwargs["operation_timeout"] == expected_operation_timeout
@@ -1196,6 +1200,7 @@ async def test_customizable_retryable_errors(
11961200
down to the gapic layer.
11971201
"""
11981202
from google.cloud.bigtable.data._metrics import ActiveOperationMetric
1203+
11991204
with mock.patch.object(
12001205
google.api_core.retry, "if_exception_type"
12011206
) as predicate_builder_mock:
@@ -1211,7 +1216,9 @@ async def test_customizable_retryable_errors(
12111216
predicate_builder_mock.return_value = expected_predicate
12121217
retry_fn_mock.side_effect = RuntimeError("stop early")
12131218
mutation = self._make_mutation(count=1, size=1)
1214-
await instance._execute_mutate_rows([mutation], ActiveOperationMetric("MUTATE_ROWS"))
1219+
await instance._execute_mutate_rows(
1220+
[mutation], ActiveOperationMetric("MUTATE_ROWS")
1221+
)
12151222
# passed in errors should be used to build the predicate
12161223
predicate_builder_mock.assert_called_once_with(
12171224
*expected_retryables, _MutateRowsIncomplete

tests/unit/data/_async/test_read_rows_acceptance.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ def _make_operation():
4646
op._remaining_count = None
4747
return op
4848

49-
5049
@staticmethod
5150
@CrossSync.convert
5251
def _get_client_class():
@@ -88,9 +87,7 @@ async def _process_chunks(self, *chunks):
8887
async def _row_stream():
8988
yield ReadRowsResponse(chunks=chunks)
9089

91-
chunker = self._make_operation().chunk_stream(
92-
self._coro_wrapper(_row_stream())
93-
)
90+
chunker = self._make_operation().chunk_stream(self._coro_wrapper(_row_stream()))
9491
merger = self._make_operation().merge_rows(chunker)
9592
results = []
9693
async for row in merger:
@@ -200,9 +197,7 @@ async def _row_stream():
200197

201198
op = self._make_operation()
202199
op._last_yielded_row_key = b"b"
203-
chunker = op.chunk_stream(
204-
self._coro_wrapper(_row_stream())
205-
)
200+
chunker = op.chunk_stream(self._coro_wrapper(_row_stream()))
206201
merger = self._make_operation().merge_rows(chunker)
207202
with pytest.raises(InvalidChunk):
208203
async for _ in merger:

tests/unit/data/_metrics/test_metrics_controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@ def test_create_operation(self):
8686
assert op.is_streaming is expected_is_streaming
8787
assert op.zone is expected_zone
8888
assert len(op.handlers) == 1
89-
assert op.handlers[0] is handler
89+
assert op.handlers[0] is handler

0 commit comments

Comments
 (0)