From 7fde62b460827e30b2b7cd34956e34e965416d86 Mon Sep 17 00:00:00 2001 From: Sharat Sharma Date: Wed, 5 Apr 2017 17:36:13 +0530 Subject: [PATCH] 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 --- mistral_tempest_tests/tests/api/v2/test_tasks.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mistral_tempest_tests/tests/api/v2/test_tasks.py b/mistral_tempest_tests/tests/api/v2/test_tasks.py index 6d530ea..130a92e 100644 --- a/mistral_tempest_tests/tests/api/v2/test_tasks.py +++ b/mistral_tempest_tests/tests/api/v2/test_tasks.py @@ -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(