pyvista_validation.check.check_contains

Contents

pyvista_validation.check.check_contains#

pyvista_validation.check.check_contains(container: Container[Any], /, must_contain: Any, *, name: str = 'Input') None#

Check if an item is in a container.

Parameters:
containerAny

Container to check.

must_containAny

Item which must be in the container.

namestr, default: “Input”

Variable name to use in the error messages if any are raised.

Raises:
ValueError

If the item is not in the container.

Examples

Check if "A" is in a list of strings.

>>> from pyvista_validation import check_contains
>>> check_contains(['A', 'B', 'C'], must_contain='A')