typetest_array

tayph.typetest_array(var, vartype, varname='var')[source] [edit on github]

This function tests the types of the elements in the array or list var against a requested variable type and raises an exception if either varname is not a string, type(var) is not equal to numpy.array or list, or the elements of var are not ALL of a type equal to vartype. A list of vartypes can be supplied to test whether the type is any of a provided set (i.e. OR logic)..

Parameters
varlist, np.array

A list of variables each of which will be tested against vartype.

vartypetype, list

A python class that would be identified with type(); or a list of classes.

varnamestr, optional

Name or description of the variable to assist in debugging.