8000 Addressing review comments. · googleapis/google-cloud-python@321435e · GitHub
[go: up one dir, main page]

Skip to content

Commit 321435e

Browse files
committed
Addressing review comments.
1 parent 0f974cb commit 321435e

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

gcloud/bigtable/row.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,10 @@ def _commit_check_and_mutate(self):
410410
def clear_mutations(self):
411411
"""Removes all currently accumulated mutations on the current row."""
412412
if self._filter is None:
413-
self._pb_mutations[:] = []
413+
del self._pb_mutations[:]
414414
else:
415-
self._true_pb_mutations[:] = []
416-
self._false_pb_mutations[:] = []
415+
del self._true_pb_mutations[:]
416+
del self._false_pb_mutations[:]
417417

418418
def commit(self):
419419
"""Makes a ``MutateRow`` or ``CheckAndMutateRow`` API request.

gcloud/bigtable/test_row.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -460,21 +460,30 @@ def test_commit_with_filter(self):
460460
row = self._makeOne(row_key, table, filter_=row_filter)
461461

462462
# Create request_pb
463-
value = b'bytes-value'
464-
mutation = data_pb2.Mutation(
463+
value1 = b'bytes-value'
464+
mutation1 = data_pb2.Mutation(
465465
set_cell=data_pb2.Mutation.SetCell(
466466
family_name=column_family_id,
467467
column_qualifier=column,
468468
timestamp_micros=-1, # Default value.
469-
value=value,
469+
value=value1,
470+
),
471+
)
472+
value2 = b'other-bytes'
473+
mutation2 = data_pb2.Mutation(
474+
set_cell=data_pb2.Mutation.SetCell(
475+
family_name=column_family_id,
476+
column_qualifier=column,
477+
timestamp_micros=-1, # Default value.
478+
value=value2,
470479
),
471480
)
472481
request_pb = messages_pb2.CheckAndMutateRowRequest(
473482
table_name=table_name,
474483
row_key=row_key,
475484
predicate_filter=row_filter.to_pb(),
476-
true_mutations=[mutation],
477-
false_mutations=[],
485+
true_mutations=[mutation1],
486+
false_mutations=[mutation2],
478487
)
479488

480489
# Create response_pb
@@ -489,7 +498,8 @@ def test_commit_with_filter(self):
489498
expected_result = predicate_matched
490499

491500
# Perform the method and check the result.
492-
row.set_cell(column_family_id, column, value, state=True)
501+
row.set_cell(column_family_id, column, value1, state=True)
502+
row.set_cell(column_family_id, column, value2, state=False)
493503
result = row.commit()
494504
self.assertEqual(result, expected_result)
495505
self.assertEqual(stub.method_calls, [(

0 commit comments

Comments
 (0)
0