2.1.21. czekitout.check.if_one_of_any_accepted_strings

if_one_of_any_accepted_strings(obj, obj_name, accepted_strings)[source]

Check whether input object is one of any given accepted strings.

If the input object is not string-like, then a TypeError exception is raised with the message:

The object ``<obj_name>`` must be string-like.

If len(accepted_strings)=1, and the input object is not the given accepted string, then a ValueError exception is raised with the message:

The object ``<obj_name>`` must be set to ``<accepted_string>``.

where <obj_name> is replaced by the contents of the string obj_name, and <accepted_string> by the accepted string.

If len(accepted_strings)>1, and the input object is not one of any given accepted string, then a ValueError exception is raised with the message:

The object ``<obj_name>`` must be set to one of the following strings: 
``<accepted_strings>``.

where <obj_name> is replaced by the contents of the string obj_name, and <accepted_strings> by the sequence of strings stored in accepted_strings.

Parameters:
objany type

Input object.

obj_namestr

Name of the input object.

accepted_stringsarray_like (str, ndim=1)

Accepted strings.