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 удалений

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

@ -1,13 +1,13 @@
#!/usr/bin/env python
# Copyright 2017 Google Inc.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -105,7 +105,7 @@ class TestKeyRange(unittest.TestCase):
# against a few sample values where keyspace_id is an int column.
def test_bind_values_for_int_keyspace(self):
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('-')
where_clause, bind_vars = vtrouting._create_where_clause_for_keyrange(kr)
if len(bind_vars.keys()) == 1:
@ -135,7 +135,7 @@ class TestKeyRange(unittest.TestCase):
# the test emulates that by using keyspace_id.encode('hex').
def test_bind_values_for_str_keyspace(self):
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('-')
where_clause, bind_vars = vtrouting._create_where_clause_for_keyrange(
kr, keyspace_col_type=keyrange_constants.KIT_BYTES)

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

@ -2,13 +2,13 @@
# coding: utf-8
# Copyright 2017 Google Inc.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -865,7 +865,7 @@ class TestCoreVTGateFunctions(BaseTestCase):
query = 'select * from vt_field_types where uint_val in ::uint_val_1'
rowcount = cursor.execute(query, {'uint_val_1': uint_val_list})
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)
self.assertIsInstance(row.uint_val, long)
self.assertGreaterEqual(