Skip to content

Commit

Permalink
Spanner: Changed _rows to list
Browse files Browse the repository at this point in the history
  • Loading branch information
chemelnucfin committed Dec 13, 2017
1 parent ee9dcee commit 0208d1c
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions spanner/tests/unit/test_streamed.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_ctor_defaults(self):
streamed = self._make_one(iterator)
self.assertIs(streamed._response_iterator, iterator)
self.assertIsNone(streamed._source)
self.assertEqual(streamed._rows, [])
self.assertEqual(list(streamed), [])
self.assertIsNone(streamed.metadata)
self.assertIsNone(streamed.stats)

Expand All @@ -43,7 +43,7 @@ def test_ctor_w_source(self):
streamed = self._make_one(iterator, source=source)
self.assertIs(streamed._response_iterator, iterator)
self.assertIs(streamed._source, source)
self.assertEqual(streamed._rows, [])
self.assertEqual(list(streamed), [])
self.assertIsNone(streamed.metadata)
self.assertIsNone(streamed.stats)

Expand Down Expand Up @@ -484,7 +484,7 @@ def test_merge_values_empty_and_empty(self):
streamed._metadata = self._make_result_set_metadata(FIELDS)
streamed._current_row = []
streamed._merge_values([])
self.assertEqual(streamed._rows, [])
self.assertEqual(list(streamed), [])
self.assertEqual(streamed._current_row, [])

def test_merge_values_empty_and_partial(self):
Expand All @@ -500,7 +500,7 @@ def test_merge_values_empty_and_partial(self):
VALUES = [self._make_value(bare) for bare in BARE]
streamed._current_row = []
streamed._merge_values(VALUES)
self.assertEqual(streamed._rows, [])
self.assertEqual(list(streamed), [])
self.assertEqual(streamed._current_row, BARE)

def test_merge_values_empty_and_filled(self):
Expand All @@ -516,7 +516,7 @@ def test_merge_values_empty_and_filled(self):
VALUES = [self._make_value(bare) for bare in BARE]
streamed._current_row = []
streamed._merge_values(VALUES)
self.assertEqual(streamed._rows, [BARE])
self.assertEqual(list(streamed), [BARE])
self.assertEqual(streamed._current_row, [])

def test_merge_values_empty_and_filled_plus(self):
Expand All @@ -536,7 +536,7 @@ def test_merge_values_empty_and_filled_plus(self):
VALUES = [self._make_value(bare) for bare in BARE]
streamed._current_row = []
streamed._merge_values(VALUES)
self.assertEqual(streamed._rows, [BARE[0:3], BARE[3:6]])
self.assertEqual(list(streamed), [BARE[0:3], BARE[3:6]])
self.assertEqual(streamed._current_row, BARE[6:])

def test_merge_values_partial_and_empty(self):
Expand All @@ -553,7 +553,7 @@ def test_merge_values_partial_and_empty(self):
]
streamed._current_row[:] = BEFORE
streamed._merge_values([])
self.assertEqual(streamed._rows, [])
self.assertEqual(list(streamed), [])
self.assertEqual(streamed._current_row, BEFORE)

def test_merge_values_partial_and_partial(self):
Expand All @@ -570,7 +570,7 @@ def test_merge_values_partial_and_partial(self):
MERGED = [42]
TO_MERGE = [self._make_value(item) for item in MERGED]
streamed._merge_values(TO_MERGE)
self.assertEqual(streamed._rows, [])
self.assertEqual(list(streamed), [])
self.assertEqual(streamed._current_row, BEFORE + MERGED)

def test_merge_values_partial_and_filled(self):
Expand All @@ -589,7 +589,7 @@ def test_merge_values_partial_and_filled(self):
MERGED = [42, True]
TO_MERGE = [self._make_value(item) for item in MERGED]
streamed._merge_values(TO_MERGE)
self.assertEqual(streamed._rows, [BEFORE + MERGED])
self.assertEqual(list(streamed), [BEFORE + MERGED])
self.assertEqual(streamed._current_row, [])

def test_merge_values_partial_and_filled_plus(self):
Expand All @@ -613,7 +613,7 @@ def test_merge_values_partial_and_filled_plus(self):
TO_MERGE = [self._make_value(item) for item in MERGED]
VALUES = BEFORE + MERGED
streamed._merge_values(TO_MERGE)
self.assertEqual(streamed._rows, [VALUES[0:3], VALUES[3:6]])
self.assertEqual(list(streamed), [VALUES[0:3], VALUES[3:6]])
self.assertEqual(streamed._current_row, VALUES[6:])

def test_one_or_none_no_value(self):
Expand Down Expand Up @@ -680,7 +680,7 @@ def test_consume_next_first_set_partial(self):
source = mock.Mock(_transaction_id=None, spec=['_transaction_id'])
streamed = self._make_one(iterator, source=source)
streamed._consume_next()
self.assertEqual(streamed._rows, [])
self.assertEqual(list(streamed), [])
self.assertEqual(streamed._current_row, BARE)
self.assertEqual(streamed.metadata, metadata)
self.assertEqual(source._transaction_id, TXN_ID)
Expand All @@ -701,7 +701,7 @@ def test_consume_next_first_set_partial_existing_txn_id(self):
source = mock.Mock(_transaction_id=TXN_ID, spec=['_transaction_id'])
streamed = self._make_one(iterator, source=source)
streamed._consume_next()
self.assertEqual(streamed._rows, [])
self.assertEqual(list(streamed), [])
self.assertEqual(streamed._current_row, BARE)
self.assertEqual(streamed.metadata, metadata)
self.assertEqual(source._transaction_id, TXN_ID)
Expand All @@ -720,7 +720,7 @@ def test_consume_next_w_partial_result(self):
streamed = self._make_one(iterator)
streamed._metadata = self._make_result_set_metadata(FIELDS)
streamed._consume_next()
self.assertEqual(streamed._rows, [])
self.assertEqual(list(streamed), [])
self.assertEqual(streamed._current_row, [])
self.assertEqual(streamed._pending_chunk, VALUES[0])

Expand All @@ -742,7 +742,7 @@ def test_consume_next_w_pending_chunk(self):
streamed._metadata = self._make_result_set_metadata(FIELDS)
streamed._pending_chunk = self._make_value(u'Phred ')
streamed._consume_next()
self.assertEqual(streamed._rows, [
self.assertEqual(list(streamed), [
[u'Phred Phlyntstone', BARE[1], BARE[2]],
[BARE[3], BARE[4], BARE[5]],
])
Expand All @@ -768,7 +768,7 @@ def test_consume_next_last_set(self):
streamed = self._make_one(iterator)
streamed._metadata = metadata
streamed._consume_next()
self.assertEqual(streamed._rows, [BARE])
self.assertEqual(list(streamed), [BARE])
self.assertEqual(streamed._current_row, [])
self.assertEqual(streamed._stats, stats)

Expand All @@ -792,7 +792,7 @@ def test___iter___one_result_set_partial(self):
streamed = self._make_one(iterator)
found = list(streamed)
self.assertEqual(found, [])
self.assertEqual(streamed._rows, [])
self.assertEqual(list(streamed), [])
self.assertEqual(streamed._current_row, BARE)
self.assertEqual(streamed.metadata, metadata)

Expand Down Expand Up @@ -820,7 +820,7 @@ def test___iter___multiple_result_sets_filled(self):
[BARE[3], BARE[4], BARE[5]],
[BARE[6], BARE[7], BARE[8]],
])
self.assertEqual(streamed._rows, [])
self.assertEqual(list(streamed), [])
self.assertEqual(streamed._current_row, [])
self.assertIsNone(streamed._pending_chunk)

Expand Down Expand Up @@ -853,7 +853,7 @@ def test___iter___w_existing_rows_read(self):
[BARE[3], BARE[4], BARE[5]],
[BARE[6], BARE[7], BARE[8]],
])
self.assertEqual(streamed._rows, [])
self.assertEqual(list(streamed), [])
self.assertEqual(streamed._current_row, [])
self.assertIsNone(streamed._pending_chunk)

Expand Down

0 comments on commit 0208d1c

Please sign in to comment.