diff options
-rw-r--r-- | ipalib/plugable.py | 2 | ||||
-rw-r--r-- | ipalib/public.py | 8 | ||||
-rw-r--r-- | ipalib/tests/test_plugable.py | 4 |
3 files changed, 11 insertions, 3 deletions
diff --git a/ipalib/plugable.py b/ipalib/plugable.py index 761d8a955..438815bb3 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -354,7 +354,7 @@ class Plugin(ReadOnly): Returns a fully qualified module_name.class_name() representation that could be used to construct this Plugin instance. """ - return '%s.%s' % ( + return '%s.%s()' % ( self.__class__.__module__, self.__class__.__name__ ) diff --git a/ipalib/public.py b/ipalib/public.py index 5a70a7153..a5385a925 100644 --- a/ipalib/public.py +++ b/ipalib/public.py @@ -189,6 +189,14 @@ class Option(plugable.ReadOnly): self.validate(value) return value + def __repr__(self): + return '%s(%r, %r, %s)' % ( + self.__class__.__name__, + self.name, + self.doc, + self.type.name, + ) + class Command(plugable.Plugin): __public__ = frozenset(( diff --git a/ipalib/tests/test_plugable.py b/ipalib/tests/test_plugable.py index a7c4d61b2..ec33989d6 100644 --- a/ipalib/tests/test_plugable.py +++ b/ipalib/tests/test_plugable.py @@ -393,7 +393,7 @@ class test_Plugin(ClassChecker): api = 'the api instance' o = self.cls() assert read_only(o, 'name') == 'Plugin' - assert repr(o) == '%s.Plugin' % plugable.__name__ + assert repr(o) == '%s.Plugin()' % plugable.__name__ assert read_only(o, 'api') is None raises(AssertionError, o.finalize, None) o.finalize(api) @@ -404,7 +404,7 @@ class test_Plugin(ClassChecker): pass sub = some_plugin() assert read_only(sub, 'name') == 'some_plugin' - assert repr(sub) == '%s.some_plugin' % __name__ + assert repr(sub) == '%s.some_plugin()' % __name__ assert read_only(sub, 'api') is None raises(AssertionError, sub.finalize, None) sub.finalize(api) |