зеркало из https://github.com/github/vitess-gh.git
Simplifying a loop in these files.
This commit is contained in:
Родитель
dd69a2662e
Коммит
99f43fb1c6
|
@ -1,13 +1,13 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
# Copyright 2017 Google Inc.
|
# Copyright 2017 Google Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# 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.
|
# 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)
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
# Copyright 2017 Google Inc.
|
# Copyright 2017 Google Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# 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'
|
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(
|
||||||
|
|
Загрузка…
Ссылка в новой задаче