fatf.utils.validation
.check_object_functionality¶
-
fatf.utils.validation.
check_object_functionality
(an_object: Union[object, type], methods: Dict[str, int], object_reference_name: Optional[str] = None) → Tuple[bool, str][source]¶ Checks if an object has specified methods with given number of parameters.
New in version 0.0.2.
The object to be checked can either be an uninitialised object reference or an initialised object instance.
- Parameters
- an_objectUnion[object, type]
A Python object (either uninitialised object reference or an initialised object) to be checked.
- methodsDictionary[string, integer]
A dictionary where keys are method names required to be in an_object and values are the number of required parameters in for these methods.
- object_reference_namestring, optional (default=’’)
A reference name of
an_object
used to provide more information in the generated (warning)message
. IfNone
, this information will not be included in themessage
.
- Returns
- is_functionalboolean
A boolean variable that indicates whether the object has all the desired functionality.
- messagestring
A message detailing the lacking functionality of
an_object
.
- Raises
- TypeError
The
methods
parameter is not a dictionary, one of its keys is not a string or one of its values is not an integer. Theobject_reference_name
parameter is neither a string norNone
.- ValueError
The
methods
dictionary is empty or one of its values is a negative integer.