Fix three broken unit tests
This commit is contained in:
1 parent
322d8238a0
commit
22493eef21
3 files changed
+9
-10
No files matched your search
@@ -118,6 +118,7 @@ class Executioner(Backend):
|
||||
'non-public: %s: %s', e.__class__.__name__, str(e)
|
||||
)
|
||||
error = InternalError()
|
||||
destroy_context()
|
||||
if error is None:
|
||||
return result
|
||||
assert isinstance(error, PublicError)
|
||||
|
||||
+1
-2
@@ -246,8 +246,7 @@ class textui(backend.Backend):
|
||||
dn: dc=example,dc=com
|
||||
>>> attr = 'objectClass'
|
||||
>>> ui.print_attribute(attr, [u'top', u'someClass'])
|
||||
objectClass: top
|
||||
objectClass: someClass
|
||||
objectClass: top, someClass
|
||||
"""
|
||||
assert isinstance(attr, basestring)
|
||||
if not isinstance(value, (list, tuple)):
|
||||
|
||||
@@ -261,13 +261,6 @@ class Param(ReadOnly):
|
||||
self.name = check_name(name)
|
||||
self.nice = '%s(%r)' % (self.__class__.__name__, self.param_spec)
|
||||
|
||||
if 'cli_short_name' in kw:
|
||||
if len(kw['cli_short_name']) != 1:
|
||||
raise TypeError(
|
||||
'%s: cli_short_name can only be a single character: %s'
|
||||
% (self.nice, kw['cli_short_name'])
|
||||
)
|
||||
|
||||
# Add 'default' to self.kwargs and makes sure no unknown kw were given:
|
||||
assert type(self.type) is type
|
||||
if kw.get('multivalue', True):
|
||||
@@ -360,6 +353,13 @@ class Param(ReadOnly):
|
||||
'%s: rules must be callable; got %r' % (self.nice, rule)
|
||||
)
|
||||
|
||||
# Check that cli_short_name is only 1 character long:
|
||||
if not (self.cli_short_name is None or len(self.cli_short_name) == 1):
|
||||
raise ValueError(
|
||||
'%s: cli_short_name can only be a single character: %s' % (
|
||||
self.nice, self.cli_short_name)
|
||||
)
|
||||
|
||||
# And we're done.
|
||||
lock(self)
|
||||
|
||||
@@ -1244,4 +1244,3 @@ def create_param(spec):
|
||||
TYPE_ERROR % ('spec', (str, Param), spec, type(spec))
|
||||
)
|
||||
return Str(spec)
|
||||
|
||||
Reference in new issue
Block a user