2.1.20. 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 one of any given accepted string, and
len(accepted_strings)=1
, then a TypeError 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 the input object is not one of any given accepted string, and
len(accepted_strings)>1
, then a TypeError 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 inaccepted_strings
.- Parameters:
- objany type
Input object.
- obj_namestr
Name of the input object.
- accepted_stringsarray_like (str, ndim=1)
Accepted strings.