From d44a392568bfbe058407f7ab3169a5778ec528b6 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: May 05 2020 17:11:37 +0000 Subject: Silence W601 .has_key() is deprecated Related: https://pagure.io/freeipa/issue/8306 Signed-off-by: Christian Heimes Reviewed-By: Florence Blanc-Renaud --- diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py index 64aaad1..f29126c 100644 --- a/ipapython/ipautil.py +++ b/ipapython/ipautil.py @@ -701,7 +701,7 @@ class CIDict(dict): if six.PY2: def has_key(self, key): # pylint: disable=no-member - return super(CIDict, self).has_key(key.lower()) + return super(CIDict, self).has_key(key.lower()) # noqa # pylint: enable=no-member def get(self, key, failobj=None): diff --git a/ipatests/test_ipapython/test_ipautil.py b/ipatests/test_ipapython/test_ipautil.py index 884d7d5..d68718c 100644 --- a/ipatests/test_ipapython/test_ipautil.py +++ b/ipatests/test_ipapython/test_ipautil.py @@ -164,11 +164,11 @@ class TestCIDict: @pytest.mark.skipif(not six.PY2, reason="Python 2 only") def test_haskey(self): - assert self.cidict.has_key("KEY1") - assert self.cidict.has_key("key2") - assert self.cidict.has_key("key3") + assert self.cidict.has_key("KEY1") # noqa + assert self.cidict.has_key("key2") # noqa + assert self.cidict.has_key("key3") # noqa - assert not self.cidict.has_key("Key4") + assert not self.cidict.has_key("Key4") # noqa def test_contains(self): assert "KEY1" in self.cidict diff --git a/ipatests/test_ipapython/test_keyring.py b/ipatests/test_ipapython/test_keyring.py index 1712541..dd2237d 100644 --- a/ipatests/test_ipapython/test_keyring.py +++ b/ipatests/test_ipapython/test_keyring.py @@ -119,10 +119,10 @@ class test_keyring: See if a key is available """ kernel_keyring.add_key(TEST_KEY, TEST_VALUE) - assert kernel_keyring.has_key(TEST_KEY) + assert kernel_keyring.has_key(TEST_KEY) # noqa kernel_keyring.del_key(TEST_KEY) - assert not kernel_keyring.has_key(TEST_KEY) + assert not kernel_keyring.has_key(TEST_KEY) # noqa def test_07(self): """ diff --git a/ipatests/test_ipaserver/test_ldap.py b/ipatests/test_ipaserver/test_ldap.py index 44f65fb..e0c52b1 100644 --- a/ipatests/test_ipaserver/test_ldap.py +++ b/ipatests/test_ipaserver/test_ldap.py @@ -249,9 +249,9 @@ class test_LDAPEntry: @pytest.mark.skipif(sys.version_info >= (3, 0), reason="Python 2 only") def test_has_key(self): e = self.entry - assert not e.has_key('xyz') - assert e.has_key('cn') - assert e.has_key('COMMONNAME') + assert not e.has_key('xyz') # noqa + assert e.has_key('cn') # noqa + assert e.has_key('COMMONNAME') # noqa def test_in(self): e = self.entry