mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
271: Improved __repr__ methods for better output from the show-plugins command
This commit is contained in:
parent
cb9c442708
commit
13f030d91e
@ -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__
|
||||
)
|
||||
|
@ -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((
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user