mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Py3: Remove subclassing from object
Python 2 had old style and new style classes. Python 3 has only new style classes. There is no point to subclass from object any more. See: https://pagure.io/freeipa/issue/7715 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
This commit is contained in:
@@ -49,7 +49,7 @@ class test_Backend(ClassChecker):
|
||||
assert self.cls.__bases__ == (plugable.Plugin,)
|
||||
|
||||
|
||||
class Disconnect(object):
|
||||
class Disconnect:
|
||||
called = False
|
||||
|
||||
def __init__(self, id=None):
|
||||
|
||||
@@ -108,7 +108,7 @@ def test_lock():
|
||||
assert str(e) == 'already locked: %r' % o
|
||||
|
||||
# Test with another class implemented locking protocol:
|
||||
class Lockable(object):
|
||||
class Lockable:
|
||||
__locked = False
|
||||
def __lock__(self):
|
||||
self.__locked = True
|
||||
@@ -122,7 +122,7 @@ def test_lock():
|
||||
assert str(e) == 'already locked: %r' % o
|
||||
|
||||
# Test with a class incorrectly implementing the locking protocol:
|
||||
class Broken(object):
|
||||
class Broken:
|
||||
def __lock__(self):
|
||||
pass
|
||||
def __islocked__(self):
|
||||
@@ -145,7 +145,7 @@ def test_islocked():
|
||||
assert f(o) is True
|
||||
|
||||
# Test with another class implemented locking protocol:
|
||||
class Lockable(object):
|
||||
class Lockable:
|
||||
__locked = False
|
||||
def __lock__(self):
|
||||
self.__locked = True
|
||||
@@ -157,7 +157,7 @@ def test_islocked():
|
||||
assert f(o) is True
|
||||
|
||||
# Test with a class incorrectly implementing the locking protocol:
|
||||
class Broken(object):
|
||||
class Broken:
|
||||
__lock__ = False
|
||||
def __islocked__(self):
|
||||
return False
|
||||
@@ -207,7 +207,7 @@ def membername(i):
|
||||
return 'member%03d' % i
|
||||
|
||||
|
||||
class DummyMember(object):
|
||||
class DummyMember:
|
||||
def __init__(self, i):
|
||||
self.i = i
|
||||
self.name = self.__name__ = membername(i)
|
||||
|
||||
@@ -76,7 +76,7 @@ def get_cmd_name(i):
|
||||
return 'cmd_%d' % i
|
||||
|
||||
|
||||
class DummyCommand(object):
|
||||
class DummyCommand:
|
||||
def __init__(self, name):
|
||||
self.__name = name
|
||||
|
||||
@@ -85,7 +85,7 @@ class DummyCommand(object):
|
||||
name = property(__get_name)
|
||||
|
||||
|
||||
class DummyAPI(object):
|
||||
class DummyAPI:
|
||||
def __init__(self, cnt):
|
||||
self.__cmd = plugable.APINameSpace(self.__cmd_iter(cnt), DummyCommand)
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ if six.PY3:
|
||||
pytestmark = pytest.mark.tier0
|
||||
|
||||
|
||||
class PrivateExceptionTester(object):
|
||||
class PrivateExceptionTester:
|
||||
_klass = None
|
||||
__klass = None
|
||||
|
||||
@@ -193,7 +193,7 @@ class test_PluginMissingOverrideError(PrivateExceptionTester):
|
||||
##############################################################################
|
||||
# Unit tests for public errors:
|
||||
|
||||
class PublicExceptionTester(object):
|
||||
class PublicExceptionTester:
|
||||
_klass = None
|
||||
__klass = None
|
||||
|
||||
@@ -338,7 +338,7 @@ class test_PublicError(PublicExceptionTester):
|
||||
assert_equal(list(inst_match),list(instructions))
|
||||
|
||||
|
||||
class BaseMessagesTest(object):
|
||||
class BaseMessagesTest:
|
||||
"""Generic test for all of a module's errors or messages
|
||||
"""
|
||||
def test_public_messages(self):
|
||||
@@ -367,7 +367,7 @@ class BaseMessagesTest(object):
|
||||
pass
|
||||
|
||||
|
||||
class test_PublicErrors(object):
|
||||
class test_PublicErrors:
|
||||
message_list = errors.public_errors
|
||||
errno_range = list(range(900, 5999))
|
||||
required_classes = (Exception, errors.PublicError)
|
||||
|
||||
@@ -71,7 +71,7 @@ def test_is_rule():
|
||||
is_rule = frontend.is_rule
|
||||
flag = frontend.RULE_FLAG
|
||||
|
||||
class no_call(object):
|
||||
class no_call:
|
||||
def __init__(self, value):
|
||||
if value is not None:
|
||||
assert value in (True, False)
|
||||
@@ -199,7 +199,7 @@ class test_Command(ClassChecker):
|
||||
"""
|
||||
Return a standard subclass of `ipalib.frontend.Command`.
|
||||
"""
|
||||
class Rule(object):
|
||||
class Rule:
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
|
||||
@@ -230,7 +230,7 @@ class test_Command(ClassChecker):
|
||||
"""
|
||||
Helper method used to test args and options.
|
||||
"""
|
||||
class api(object):
|
||||
class api:
|
||||
@staticmethod
|
||||
def is_production_mode():
|
||||
return False
|
||||
@@ -276,7 +276,7 @@ class test_Command(ClassChecker):
|
||||
"""
|
||||
Test the ``ipalib.frontend.Command.args`` instance attribute.
|
||||
"""
|
||||
class api(object):
|
||||
class api:
|
||||
@staticmethod
|
||||
def is_production_mode():
|
||||
return False
|
||||
@@ -333,7 +333,7 @@ class test_Command(ClassChecker):
|
||||
"""
|
||||
Test the ``ipalib.frontend.Command.options`` instance attribute.
|
||||
"""
|
||||
class api(object):
|
||||
class api:
|
||||
@staticmethod
|
||||
def is_production_mode():
|
||||
return False
|
||||
@@ -357,7 +357,7 @@ class test_Command(ClassChecker):
|
||||
"""
|
||||
Test the ``ipalib.frontend.Command.output`` instance attribute.
|
||||
"""
|
||||
class api(object):
|
||||
class api:
|
||||
@staticmethod
|
||||
def is_production_mode():
|
||||
return False
|
||||
@@ -405,7 +405,7 @@ class test_Command(ClassChecker):
|
||||
"""
|
||||
Test the `ipalib.frontend.Command.convert` method.
|
||||
"""
|
||||
class api(object):
|
||||
class api:
|
||||
@staticmethod
|
||||
def is_production_mode():
|
||||
return False
|
||||
@@ -422,7 +422,7 @@ class test_Command(ClassChecker):
|
||||
"""
|
||||
Test the `ipalib.frontend.Command.normalize` method.
|
||||
"""
|
||||
class api(object):
|
||||
class api:
|
||||
@staticmethod
|
||||
def is_production_mode():
|
||||
return False
|
||||
@@ -470,7 +470,7 @@ class test_Command(ClassChecker):
|
||||
"""
|
||||
Test the `ipalib.frontend.Command.validate` method.
|
||||
"""
|
||||
class api(object):
|
||||
class api:
|
||||
env = config.Env(context='cli')
|
||||
@staticmethod
|
||||
def is_production_mode():
|
||||
@@ -689,7 +689,7 @@ class test_Command(ClassChecker):
|
||||
"""
|
||||
Test the `ipalib.frontend.Command.validate_output` method.
|
||||
"""
|
||||
class api(object):
|
||||
class api:
|
||||
@staticmethod
|
||||
def is_production_mode():
|
||||
return False
|
||||
@@ -731,7 +731,7 @@ class test_Command(ClassChecker):
|
||||
"""
|
||||
Test `ipalib.frontend.Command.validate_output` per-type validation.
|
||||
"""
|
||||
class api(object):
|
||||
class api:
|
||||
@staticmethod
|
||||
def is_production_mode():
|
||||
return False
|
||||
@@ -760,7 +760,7 @@ class test_Command(ClassChecker):
|
||||
"""
|
||||
Test `ipalib.frontend.Command.validate_output` nested validation.
|
||||
"""
|
||||
class api(object):
|
||||
class api:
|
||||
@staticmethod
|
||||
def is_production_mode():
|
||||
return False
|
||||
@@ -795,7 +795,7 @@ class test_Command(ClassChecker):
|
||||
"""
|
||||
Test the `ipalib.frontend.Command.get_output_params` method.
|
||||
"""
|
||||
class api(object):
|
||||
class api:
|
||||
@staticmethod
|
||||
def is_production_mode():
|
||||
return False
|
||||
@@ -831,7 +831,7 @@ class test_LocalOrRemote(ClassChecker):
|
||||
"""
|
||||
Test the `ipalib.frontend.LocalOrRemote.__init__` method.
|
||||
"""
|
||||
class api(object):
|
||||
class api:
|
||||
@staticmethod
|
||||
def is_production_mode():
|
||||
return False
|
||||
@@ -914,7 +914,7 @@ class test_Object(ClassChecker):
|
||||
Test the `ipalib.frontend.Object.__init__` method.
|
||||
"""
|
||||
# Setup for test:
|
||||
class DummyAttribute(object):
|
||||
class DummyAttribute:
|
||||
def __init__(self, obj_name, attr_name, name=None):
|
||||
self.obj_name = obj_name
|
||||
self.attr_name = attr_name
|
||||
@@ -942,7 +942,7 @@ class test_Object(ClassChecker):
|
||||
cnt = 10
|
||||
methods_format = 'method_%d'
|
||||
|
||||
class FakeAPI(object):
|
||||
class FakeAPI:
|
||||
def __init__(self):
|
||||
self._API__plugins = get_attributes(cnt, methods_format)
|
||||
self._API__default_map = {}
|
||||
@@ -1111,13 +1111,16 @@ class test_Attribute(ClassChecker):
|
||||
Test the `ipalib.frontend.Attribute.__init__` method.
|
||||
"""
|
||||
user_obj = 'The user frontend.Object instance'
|
||||
class api(object):
|
||||
|
||||
class api:
|
||||
Object = {("user", "1"): user_obj}
|
||||
@staticmethod
|
||||
def is_production_mode():
|
||||
return False
|
||||
|
||||
class user_add(self.cls):
|
||||
pass
|
||||
|
||||
o = user_add(api)
|
||||
assert read_only(o, 'api') is api
|
||||
assert read_only(o, 'obj') is user_obj
|
||||
|
||||
@@ -173,7 +173,7 @@ def test_parse_param_spec():
|
||||
assert str(e) == TYPE_ERROR % ('spec', str, bad_value, type(bad_value))
|
||||
|
||||
|
||||
class DummyRule(object):
|
||||
class DummyRule:
|
||||
def __init__(self, error=None):
|
||||
assert error is None or type(error) is unicode
|
||||
self.error = error
|
||||
@@ -581,7 +581,7 @@ class test_Param(ClassChecker):
|
||||
"""
|
||||
Test the `ipalib.parameters.Param.get_default` method.
|
||||
"""
|
||||
class PassThrough(object):
|
||||
class PassThrough:
|
||||
value = None
|
||||
|
||||
def __call__(self, value):
|
||||
|
||||
@@ -35,6 +35,7 @@ import pytest
|
||||
|
||||
pytestmark = pytest.mark.tier0
|
||||
|
||||
|
||||
class test_Plugin(ClassChecker):
|
||||
"""
|
||||
Test the `ipalib.plugable.Plugin` class.
|
||||
@@ -88,7 +89,7 @@ class test_Plugin(ClassChecker):
|
||||
"""
|
||||
Test the `ipalib.plugable.Plugin.finalize` method.
|
||||
"""
|
||||
class api(object):
|
||||
class api:
|
||||
@staticmethod
|
||||
def is_production_mode():
|
||||
return False
|
||||
@@ -102,14 +103,15 @@ def test_Registry():
|
||||
"""
|
||||
Test the `ipalib.plugable.Registry` class
|
||||
"""
|
||||
class Base1(object):
|
||||
pass
|
||||
class Base2(object):
|
||||
class Base1:
|
||||
pass
|
||||
|
||||
class Base2:
|
||||
pass
|
||||
|
||||
class plugin1(Base1):
|
||||
pass
|
||||
|
||||
class plugin2(Base2):
|
||||
pass
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ class test_xmlclient(PluginTester):
|
||||
|
||||
@pytest.mark.skip_ipaclient_unittest
|
||||
@pytest.mark.needs_ipaapi
|
||||
class test_xml_introspection(object):
|
||||
class test_xml_introspection:
|
||||
@classmethod
|
||||
def setup_class(cls):
|
||||
try:
|
||||
|
||||
@@ -50,7 +50,7 @@ def test_create_translation():
|
||||
assert context.__dict__[key] is t
|
||||
|
||||
|
||||
class test_TestLang(object):
|
||||
class test_TestLang:
|
||||
lang_env_vars = {'LC_ALL', 'LC_MESSAGES', 'LANGUAGE', 'LANG'}
|
||||
|
||||
def setup_lang(self):
|
||||
@@ -148,7 +148,8 @@ class test_TestLang(object):
|
||||
result = self.po_file_iterate(self.po_file, get_msgstr, get_msgstr_plural)
|
||||
assert result == 0
|
||||
|
||||
class test_LazyText(object):
|
||||
|
||||
class test_LazyText:
|
||||
|
||||
klass = text.LazyText
|
||||
|
||||
@@ -159,7 +160,7 @@ class test_LazyText(object):
|
||||
assert inst.key == ('foo', 'bar')
|
||||
|
||||
|
||||
class test_FixMe(object):
|
||||
class test_FixMe:
|
||||
klass = text.FixMe
|
||||
|
||||
def test_init(self):
|
||||
@@ -178,7 +179,7 @@ class test_FixMe(object):
|
||||
assert type(unicode(inst)) is unicode
|
||||
|
||||
|
||||
class test_Gettext(object):
|
||||
class test_Gettext:
|
||||
|
||||
klass = text.Gettext
|
||||
|
||||
@@ -240,7 +241,7 @@ class test_Gettext(object):
|
||||
assert (inst4 != inst1) is True
|
||||
|
||||
|
||||
class test_NGettext(object):
|
||||
class test_NGettext:
|
||||
|
||||
klass = text.NGettext
|
||||
|
||||
@@ -318,7 +319,7 @@ class test_NGettext(object):
|
||||
assert (inst4 != inst1) is True
|
||||
|
||||
|
||||
class test_GettextFactory(object):
|
||||
class test_GettextFactory:
|
||||
|
||||
klass = text.GettextFactory
|
||||
|
||||
@@ -351,7 +352,7 @@ class test_GettextFactory(object):
|
||||
assert g.localedir == 'bar'
|
||||
|
||||
|
||||
class test_NGettextFactory(object):
|
||||
class test_NGettextFactory:
|
||||
|
||||
klass = text.NGettextFactory
|
||||
|
||||
@@ -385,7 +386,7 @@ class test_NGettextFactory(object):
|
||||
assert ng.localedir == 'bar'
|
||||
|
||||
|
||||
class test_ConcatenatedText(object):
|
||||
class test_ConcatenatedText:
|
||||
|
||||
klass = text.ConcatenatedLazyText
|
||||
|
||||
|
||||
@@ -160,7 +160,8 @@ QUs1Hx1wL7mL4U8fKCFDKA+ds2B2xWgoZg==
|
||||
-----END CERTIFICATE-----
|
||||
'''
|
||||
|
||||
class test_x509(object):
|
||||
|
||||
class test_x509:
|
||||
"""
|
||||
Test `ipalib.x509`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user