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: Ic68ba358d51002e1a1aeac6159248ffb730b5daf
This commit is contained in:
gengchc2 2016-12-09 13:44:44 +08:00
parent 2241e8ab16
commit 00221d59b9
2 changed files with 2 additions and 3 deletions

View File

@ -95,7 +95,7 @@ class SecurityServiceListMixin(object):
self.assertTrue(any(self.ss_ldap['id'] == ss['id'] for ss in listed))
for ss in listed:
self.assertTrue(all(ss[key] == value for key, value
in six.iteritems(search_opts)))
in search_opts.items()))
class SecurityServicesTest(base.BaseSharesTest,

View File

@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
from tempest import config
import testtools
from testtools import testcase as tc
@ -93,7 +92,7 @@ class ShareNetworkListMixin(object):
created_since = valid_filter_opts.pop('created_since')
for sn in listed:
self.assertTrue(all(sn[key] == value for key, value in
six.iteritems(valid_filter_opts)))
valid_filter_opts.items()))
self.assertLessEqual(sn['created_at'], created_before)
self.assertGreaterEqual(sn['created_at'], created_since)