Replace six.iteritems() with .items()
1.As mentioned in [1], we should avoid using six.iteritems to achieve iterators. We can use dict.items instead, as it will return iterators in PY3 as well. And dict.items/keys will more readable. 2.In py2, the performance about list should be negligible, see the link [2]. [1] https://wiki.openstack.org/wiki/Python3 [2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html Change-Id: I79c7bd34c37ef5bd9e789ccdb24e04bc547e5027
This commit is contained in:
parent
f6d904fcf3
commit
7fde62b460
|
@ -12,8 +12,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
|
||||
from oslo_concurrency.fixture import lockutils
|
||||
from tempest.lib import decorators
|
||||
from tempest import test
|
||||
|
@ -96,7 +94,7 @@ class TaskTypesTestsV2(base.TestCase):
|
|||
self.assertEqual(200, resp.status)
|
||||
|
||||
bt = body['tasks']
|
||||
ll = [[v for k, v in six.iteritems(d) if 'type' in k] for d in bt]
|
||||
ll = [[v for k, v in d.items() if 'type' in k] for d in bt]
|
||||
types_list = [item for sublist in ll for item in sublist]
|
||||
|
||||
self.assertIn(
|
||||
|
|
Loading…
Reference in New Issue