coverage
This commit is contained in:
@ -23,7 +23,7 @@ from types import FunctionType
|
||||
import warnings
|
||||
import sys
|
||||
|
||||
if sys.version_info[0] >= 3:
|
||||
if sys.version_info[0] >= 3: # pragma: no cover
|
||||
from inspect import signature
|
||||
else:
|
||||
from inspect import getargspec
|
||||
@ -190,7 +190,7 @@ class Base(StorageBase):
|
||||
if defaults is None:
|
||||
defaults = []
|
||||
args = func_args.args[0:len(func_args.args)-len(defaults)]
|
||||
else:
|
||||
else: # pragma: no cover
|
||||
func_params = signature(validator).parameters
|
||||
args = [f.name for f in func_params.values() if f.default is f.empty]
|
||||
if validator_params is not None:
|
||||
@ -273,14 +273,9 @@ class BaseOption(Base):
|
||||
is_readonly = False
|
||||
# never change _name dans _opt
|
||||
if name == '_name':
|
||||
try:
|
||||
if self.impl_getname() is not None:
|
||||
#so _name is already set
|
||||
is_readonly = True
|
||||
except (KeyError, AttributeError):
|
||||
pass
|
||||
elif name == '_opt':
|
||||
pass
|
||||
if self.impl_getname() is not None:
|
||||
#so _name is already set
|
||||
is_readonly = True
|
||||
elif name != '_readonly':
|
||||
is_readonly = self.impl_is_readonly()
|
||||
if is_readonly:
|
||||
@ -635,10 +630,6 @@ class Option(OnlyOption):
|
||||
|
||||
def impl_get_master_slaves(self):
|
||||
masterslaves = self._get_master_slave()
|
||||
if masterslaves is None:
|
||||
return None
|
||||
if not isinstance(masterslaves, MasterSlaves):
|
||||
return MasterSlaves(masterslaves)
|
||||
return masterslaves
|
||||
|
||||
def impl_getdoc(self):
|
||||
@ -906,8 +897,8 @@ def validate_requires_arg(new_option, multi, requires, name):
|
||||
def get_operator(require):
|
||||
operator = require.get('operator', 'or')
|
||||
if operator not in ['and', 'or']:
|
||||
raise ValueError(_('malformed requirements for option: {0}'
|
||||
' operator must be "or" or "and"'))
|
||||
raise ValueError(_('malformed requirements for option: "{0}"'
|
||||
' operator must be "or" or "and"').format(operator))
|
||||
return operator
|
||||
|
||||
|
||||
@ -968,11 +959,7 @@ class SymLinkOption(OnlyOption):
|
||||
self.commit(session)
|
||||
|
||||
def __getattr__(self, name, context=undefined):
|
||||
if name in ('_opt', '_readonly', 'impl_getpath', '_name',
|
||||
'_impl_setopt'):
|
||||
return object.__getattr__(self, name)
|
||||
else:
|
||||
return getattr(self._impl_getopt(), name)
|
||||
return getattr(self._impl_getopt(), name)
|
||||
|
||||
def impl_get_information(self, key, default=undefined):
|
||||
return self._impl_getopt().impl_get_information(key, default)
|
||||
@ -1012,10 +999,7 @@ class DynSymLinkOption(object):
|
||||
self._opt = opt
|
||||
|
||||
def __getattr__(self, name, context=undefined):
|
||||
if name in ('_opt', '_readonly', 'impl_getpath', '_name'):
|
||||
return object.__getattr__(self, name)
|
||||
else:
|
||||
return getattr(self._impl_getopt(), name)
|
||||
return getattr(self._impl_getopt(), name)
|
||||
|
||||
def impl_getname(self):
|
||||
return self._name
|
||||
|
Reference in New Issue
Block a user