def test_sanity():
 import exceptions
 special_types = ['UnicodeTranslateError', 'UnicodeEncodeError', 'UnicodeDecodeError']
 exception_types = [x for x in exceptions.__dict__.keys() if ((x.startswith('__') == False) and (special_types.count(x) == 0))]
 exception_types = [eval(('exceptions.' + x)) for x in exception_types]
 for exception_type in exception_types:
  except_list = [exception_type(), exception_type('a single param')]
  for t_except in except_list:
   try:
    raise t_except
   except exception_type as e:
    pass
   str_except = str(t_except)
   Assert((not hasattr(t_except, '__getstate__')))
 if (not is_silverlight):
  encode_except = exceptions.UnicodeEncodeError('1', u'2', 3, 4, '5')
  AreEqual(encode_except.encoding, '1')
  AreEqual(encode_except.object, u'2')
  AreEqual(encode_except.start, 3)
  AreEqual(encode_except.end, 4)
  AreEqual(encode_except.reason, '5')
  AreEqual(encode_except.message, '')
  exceptions.UnicodeDecodeError('1', '2', 3, 4, 'e')
  decode_except = exceptions.UnicodeDecodeError('1', '2', 3, 4, '5')
  AreEqual(decode_except.encoding, '1')
  AreEqual(decode_except.object, '2')
  AreEqual(decode_except.start, 3)
  AreEqual(decode_except.end, 4)
  AreEqual(decode_except.reason, '5')
  AreEqual(decode_except.message, '')
  translate_except = exceptions.UnicodeTranslateError(u'1', 2, 3, '4')
  AreEqual(translate_except.object, u'1')
  AreEqual(translate_except.start, 2)
  AreEqual(translate_except.end, 3)
  AreEqual(translate_except.reason, '4')
  AreEqual(translate_except.message, '')
  AreEqual(translate_except.encoding, None)

def test_sanity ( ) : import exceptions special_types = [ 'UnicodeTranslateError' , 'UnicodeEncodeError' , 'UnicodeDecodeError' ] exception_types = [ x for x in exceptions . __dict__ . keys ( ) if ( ( x . startswith ( '__' ) == False ) and ( special_types . count ( x ) == 0 ) ) ] exception_types = [ eval ( ( 'exceptions.' + x ) ) for x in exception_types ] for exception_type in exception_types : except_list = [ exception_type ( ) , exception_type ( 'a single param' ) ] for t_except in except_list : try : raise t_except except exception_type as e : pass str_except = str ( t_except ) Assert ( ( not hasattr ( t_except , '__getstate__' ) ) ) if ( not is_silverlight ) : encode_except = exceptions . UnicodeEncodeError ( '1' , u'2' , 3 , 4 , '5' ) AreEqual ( encode_except . encoding , '1' ) AreEqual ( encode_except . object , u'2' ) AreEqual ( encode_except . start , 3 ) AreEqual ( encode_except . end , 4 ) AreEqual ( encode_except . reason , '5' ) AreEqual ( encode_except . message , '' ) exceptions . UnicodeDecodeError ( '1' , '2' , 3 , 4 , 'e' ) decode_except = exceptions . UnicodeDecodeError ( '1' , '2' , 3 , 4 , '5' ) AreEqual ( decode_except . encoding , '1' ) AreEqual ( decode_except . object , '2' ) AreEqual ( decode_except . start , 3 ) AreEqual ( decode_except . end , 4 ) AreEqual ( decode_except . reason , '5' ) AreEqual ( decode_except . message , '' ) translate_except = exceptions . UnicodeTranslateError ( u'1' , 2 , 3 , '4' ) AreEqual ( translate_except . object , u'1' ) AreEqual ( translate_except . start , 2 ) AreEqual ( translate_except . end , 3 ) AreEqual ( translate_except . reason , '4' ) AreEqual ( translate_except . message , '' ) AreEqual ( translate_except . encoding , None )
URL minimal sanity check .