typetest

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

This function tests the type of var against a requested variable type and raises an exception if either varname is not a string, or if type(var) is not 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
varany variable

The variable that needs to be tested.

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.