Simplifying a loop in these files.

This commit is contained in:
Alain Jobart 2017-06-14 07:13:52 -07:00
Родитель dd69a2662e
Коммит 99f43fb1c6
2 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -105,7 +105,7 @@ class TestKeyRange(unittest.TestCase):
# against a few sample values where keyspace_id is an int column. # against a few sample values where keyspace_id is an int column.
def test_bind_values_for_int_keyspace(self): def test_bind_values_for_int_keyspace(self):
stm = vtrouting.create_parallel_task_keyrange_map(16, 16) stm = vtrouting.create_parallel_task_keyrange_map(16, 16)
for _, kr in enumerate(stm.keyrange_list): for kr in stm.keyrange_list:
kr_parts = kr.split('-') kr_parts = kr.split('-')
where_clause, bind_vars = vtrouting._create_where_clause_for_keyrange(kr) where_clause, bind_vars = vtrouting._create_where_clause_for_keyrange(kr)
if len(bind_vars.keys()) == 1: if len(bind_vars.keys()) == 1:
@ -135,7 +135,7 @@ class TestKeyRange(unittest.TestCase):
# the test emulates that by using keyspace_id.encode('hex'). # the test emulates that by using keyspace_id.encode('hex').
def test_bind_values_for_str_keyspace(self): def test_bind_values_for_str_keyspace(self):
stm = vtrouting.create_parallel_task_keyrange_map(16, 16) stm = vtrouting.create_parallel_task_keyrange_map(16, 16)
for _, kr in enumerate(stm.keyrange_list): for kr in stm.keyrange_list:
kr_parts = kr.split('-') kr_parts = kr.split('-')
where_clause, bind_vars = vtrouting._create_where_clause_for_keyrange( where_clause, bind_vars = vtrouting._create_where_clause_for_keyrange(
kr, keyspace_col_type=keyrange_constants.KIT_BYTES) kr, keyspace_col_type=keyrange_constants.KIT_BYTES)

Просмотреть файл

@ -865,7 +865,7 @@ class TestCoreVTGateFunctions(BaseTestCase):
query = 'select * from vt_field_types where uint_val in ::uint_val_1' query = 'select * from vt_field_types where uint_val in ::uint_val_1'
rowcount = cursor.execute(query, {'uint_val_1': uint_val_list}) rowcount = cursor.execute(query, {'uint_val_1': uint_val_list})
self.assertEqual(rowcount, len(uint_val_list), "rowcount doesn't match") self.assertEqual(rowcount, len(uint_val_list), "rowcount doesn't match")
for _, r in enumerate(cursor.results): for r in cursor.results:
row = DBRow(field_names, r) row = DBRow(field_names, r)
self.assertIsInstance(row.uint_val, long) self.assertIsInstance(row.uint_val, long)
self.assertGreaterEqual( self.assertGreaterEqual(