param_options#

paramcheckup.parameters.param_options(option, options, param_name, kind, kind_name, stacklevel=4, error=True)[source]#

This function checks whether a option is a valid options for param_name.

Parameters:
optionany

The parameter option to be evaluated;

optionslist

A list with all the possible values for param_name;

param_namestr

The name of the parameter that received the variable

kindstr

The object where param_name is applied (function, method, class, etc.);

kind_namestr

The name of the object kind;

stacklevelint, optional

The stacking level (default is 4);

errorbool, optional

Whether to display error text (True, default) or not (False);

Returns:
outputTrue

If option IS in options;

raisesValueError

If option is NOT in options;

Examples

>>> from paramcheckup import parameters
>>> result = parameters.param_options(
    option="tukey",
    options=["tukey", "fisher", "dunett"],
    param_name="test",
    kind="function",
    kind_name="comparison_test",
    stacklevel=3,
    error=True,
)
>>> print(result)
True
>>> from paramcheckup import parameters
>>> result = parameters.param_options(
    option="Student",
    options=["tukey", "fisher", "dunett"],
    param_name="test",
    kind="function",
    kind_name="comparison_test",
    stacklevel=3,
    error=False,
)
UserWarning at line 2: The `Student` is not a valid option for `test` in function `comparison_test`.
Only the following options are accepted:
--> tukey
--> fisher
--> dunett