def assertIsInstance(obj, cls, msg=''):
 if (not isinstance(obj, cls)):
  err_msg = '{0}Expected type {1}, found {2} instead'
  raise AssertionError(err_msg.format(msg, cls, type(obj)))

def assertIsInstance ( obj , cls , msg = '' ) : if ( not isinstance ( obj , cls ) ) : err_msg = '{0}Expected type {1}, found {2} instead' raise AssertionError ( err_msg . format ( msg , cls , type ( obj ) ) )
test that obj is an instance of cls (which can be a class or a tuple of classes .