mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-11 00:31:56 -06:00
14: Added Named.cli property that returns name.replace('_', '-'); Named.doc property now does a strip() to make it more user-friendly; added test_Named unit tests which somehow got dropped, uppdated with new Named properties
This commit is contained in:
parent
370282819d
commit
c2df391569
@ -132,8 +132,12 @@ class Named(object):
|
|||||||
return self.__class__.__name__
|
return self.__class__.__name__
|
||||||
name = property(__get_name)
|
name = property(__get_name)
|
||||||
|
|
||||||
|
def __get_cli(self):
|
||||||
|
return self.name.replace('_', '-')
|
||||||
|
cli = property(__get_cli)
|
||||||
|
|
||||||
def __get_doc(self):
|
def __get_doc(self):
|
||||||
return self.__class__.__doc__
|
return self.__class__.__doc__.strip()
|
||||||
doc = property(__get_doc)
|
doc = property(__get_doc)
|
||||||
|
|
||||||
|
|
||||||
|
@ -183,6 +183,17 @@ class test_NameSpace:
|
|||||||
assert len(kw) == len(ns) == 3
|
assert len(kw) == len(ns) == 3
|
||||||
|
|
||||||
|
|
||||||
|
def test_Named():
|
||||||
|
class named_class(base.Named):
|
||||||
|
"""
|
||||||
|
This class is so introspective!
|
||||||
|
"""
|
||||||
|
i = named_class()
|
||||||
|
assert i.name == 'named_class'
|
||||||
|
assert i.cli == 'named-class'
|
||||||
|
assert i.doc == 'This class is so introspective!'
|
||||||
|
|
||||||
|
|
||||||
def test_Command():
|
def test_Command():
|
||||||
class user(object):
|
class user(object):
|
||||||
name = 'user'
|
name = 'user'
|
||||||
|
Loading…
Reference in New Issue
Block a user