diff options
| author | Petr Viktorin <pviktori@redhat.com> | 2015-08-12 12:25:30 +0200 |
|---|---|---|
| committer | Jan Cholasta <jcholast@redhat.com> | 2015-09-01 11:42:01 +0200 |
| commit | ace63f4ea55643cb99aaa444d216a6bb9ebb1ed3 (patch) | |
| tree | 0b5367a1b43369dc0ea20b9e8fde91d44abed1f1 /ipatests | |
| parent | fbacc26a6a8b92f4b3570c411b186ab86cbcc1b1 (diff) | |
| download | freeipa-ace63f4ea55643cb99aaa444d216a6bb9ebb1ed3.tar.gz freeipa-ace63f4ea55643cb99aaa444d216a6bb9ebb1ed3.tar.xz freeipa-ace63f4ea55643cb99aaa444d216a6bb9ebb1ed3.zip | |
Replace uses of map()
In Python 2, map() returns a list; in Python 3 it returns an iterator.
Replace all uses by list comprehensions, generators, or for loops,
as required.
Reviewed-By: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipatests')
| -rw-r--r-- | ipatests/test_integration/base.py | 2 | ||||
| -rw-r--r-- | ipatests/test_ipalib/test_errors.py | 3 | ||||
| -rw-r--r-- | ipatests/test_xmlrpc/test_add_remove_cert_cmd.py | 6 | ||||
| -rw-r--r-- | ipatests/test_xmlrpc/test_vault_plugin.py | 2 |
4 files changed, 6 insertions, 7 deletions
diff --git a/ipatests/test_integration/base.py b/ipatests/test_integration/base.py index ee41b4142..4f57e9590 100644 --- a/ipatests/test_integration/base.py +++ b/ipatests/test_integration/base.py @@ -54,7 +54,7 @@ class IntegrationTest(object): @classmethod def get_all_hosts(cls): return ([cls.master] + cls.replicas + cls.clients + - map(cls.host_by_role, cls.required_extra_roles)) + [cls.host_by_role(r) for r in cls.required_extra_roles]) @classmethod def get_domains(cls): diff --git a/ipatests/test_ipalib/test_errors.py b/ipatests/test_ipalib/test_errors.py index 938b9fcec..dfe60f283 100644 --- a/ipatests/test_ipalib/test_errors.py +++ b/ipatests/test_ipalib/test_errors.py @@ -329,8 +329,7 @@ class test_PublicError(PublicExceptionTester): # this expression checks if each word of instructions # exists in a string as a separate line, with right order regexp = re.compile('(?ims).*' + - ''.join(map(lambda x: '(%s).*' % (x), - instructions)) + + ''.join('(%s).*' % (x) for x in instructions) + '$') inst = subclass(instructions=instructions, **kw) assert inst.format is subclass.format diff --git a/ipatests/test_xmlrpc/test_add_remove_cert_cmd.py b/ipatests/test_xmlrpc/test_add_remove_cert_cmd.py index c414498a2..e42c1929f 100644 --- a/ipatests/test_xmlrpc/test_add_remove_cert_cmd.py +++ b/ipatests/test_xmlrpc/test_add_remove_cert_cmd.py @@ -191,7 +191,7 @@ class CertManipCmdTestBase(XMLRPC_test): """ assert_deepequal( dict( - usercertificate=map(base64.b64decode, self.certs), + usercertificate=[base64.b64decode(c) for c in self.certs], summary=self.cert_add_summary % self.entity_pkey, value=self.entity_pkey, ), @@ -237,8 +237,8 @@ class CertManipCmdTestBase(XMLRPC_test): """ assert_deepequal( dict( - usercertificate=map(base64.b64decode, - self.certs_remainder), + usercertificate=[base64.b64decode(c) + for c in self.certs_remainder], summary=self.cert_del_summary % self.entity_pkey, value=self.entity_pkey, ), diff --git a/ipatests/test_xmlrpc/test_vault_plugin.py b/ipatests/test_xmlrpc/test_vault_plugin.py index 495512dac..f3b0e0135 100644 --- a/ipatests/test_xmlrpc/test_vault_plugin.py +++ b/ipatests/test_xmlrpc/test_vault_plugin.py @@ -34,7 +34,7 @@ symmetric_vault_name = u'symmetric_test_vault' asymmetric_vault_name = u'asymmetric_test_vault' # binary data from \x00 to \xff -secret = ''.join(map(chr, xrange(0, 256))) +secret = ''.join(chr(c) for c in xrange(0, 256)) password = u'password' other_password = u'other_password' |
