summaryrefslogtreecommitdiffstats
path: root/ipatests/test_xmlrpc
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2015-08-11 13:51:14 +0200
committerJan Cholasta <jcholast@redhat.com>2015-09-01 11:42:01 +0200
commit3bf91eab25c602a6fad2665456f57e8629c5a6f4 (patch)
tree52f713e898a385d57a914d539a7da9a20fc20166 /ipatests/test_xmlrpc
parentdd16cc98b0d67f1448bf9de25f8adce512b1431c (diff)
downloadfreeipa-3bf91eab25c602a6fad2665456f57e8629c5a6f4.tar.gz
freeipa-3bf91eab25c602a6fad2665456f57e8629c5a6f4.tar.xz
freeipa-3bf91eab25c602a6fad2665456f57e8629c5a6f4.zip
Use Python3-compatible dict method names
Python 2 has keys()/values()/items(), which return lists, iterkeys()/itervalues()/iteritems(), which return iterators, and viewkeys()/viewvalues()/viewitems() which return views. Python 3 has only keys()/values()/items(), which return views. To get iterators, one can use iter() or a for loop/comprehension; for lists there's the list() constructor. When iterating through the entire dict, without modifying the dict, the difference between Python 2's items() and iteritems() is negligible, especially on small dicts (the main overhead is extra memory, not CPU time). In the interest of simpler code, this patch changes many instances of iteritems() to items(), iterkeys() to keys() etc. In other cases, helpers like six.itervalues are used. Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipatests/test_xmlrpc')
-rw-r--r--ipatests/test_xmlrpc/ldaptracker.py2
-rw-r--r--ipatests/test_xmlrpc/test_pwpolicy_plugin.py3
2 files changed, 2 insertions, 3 deletions
diff --git a/ipatests/test_xmlrpc/ldaptracker.py b/ipatests/test_xmlrpc/ldaptracker.py
index 9cc44f8a6..bf753a5c5 100644
--- a/ipatests/test_xmlrpc/ldaptracker.py
+++ b/ipatests/test_xmlrpc/ldaptracker.py
@@ -122,7 +122,7 @@ class Tracker(object):
args_repr = ', '.join(
[repr(a) for a in args] +
- ['%s=%r' % item for item in options.items()])
+ ['%s=%r' % item for item in list(options.items())])
try:
result = cmd(*args, **options)
except Exception as e:
diff --git a/ipatests/test_xmlrpc/test_pwpolicy_plugin.py b/ipatests/test_xmlrpc/test_pwpolicy_plugin.py
index 5a8ac1030..3739aa893 100644
--- a/ipatests/test_xmlrpc/test_pwpolicy_plugin.py
+++ b/ipatests/test_xmlrpc/test_pwpolicy_plugin.py
@@ -30,7 +30,6 @@ from ipatests.test_xmlrpc import objectclasses
from ipatests.test_xmlrpc.xmlrpc_test import (XMLRPC_test, assert_attr_equal,
Declarative)
-
class test_pwpolicy(XMLRPC_test):
"""
Test the `pwpolicy` plugin.
@@ -195,7 +194,7 @@ class test_pwpolicy(XMLRPC_test):
# Test that returned values match the arguments
# Only test the second and third results; the first one was modified
for entry, expected in (result[1], self.kw2), (result[2], self.kw3):
- for name, value in expected.iteritems():
+ for name, value in expected.items():
assert_attr_equal(entry, name, str(value))
def test_c_pwpolicy_find_pkey_only(self):