def test_neg_clrtype_wrong_params():
 global called
 called = False
 class MyType(type, ):
  def __clrtype__():
   global called
   called = True
   return super(MyType, self).__clrtype__()
 try:
  class X(object, ):
   __metaclass__ = MyType
  Fail('Bad __clrtype__ signature!')
 except TypeError as e:
  AreEqual(e.message, '__clrtype__() takes no arguments (1 given)')
 finally:
  AreEqual(called, False)
 called = False
 class MyType(type, ):
  def __clrtype__(not_self):
   global called
   called = True
   return super(MyType, not_self).__clrtype__()
 class X(object, ):
  __metaclass__ = MyType
 AreEqual(called, True)
 called = False
 class MyType(type, ):
  def __clrtype__(self, stuff):
   global called
   called = True
   return super(MyType, self).__clrtype__()
 try:
  class X(object, ):
   __metaclass__ = MyType
  Fail('Bad __clrtype__ signature!')
 except TypeError as e:
  AreEqual(e.message, '__clrtype__() takes exactly 2 arguments (1 given)')
 finally:
  AreEqual(called, False)

def test_neg_clrtype_wrong_params ( ) : global called called = False class MyType ( type , ) : def __clrtype__ ( ) : global called called = True return super ( MyType , self ) . __clrtype__ ( ) try : class X ( object , ) : __metaclass__ = MyType Fail ( 'Bad __clrtype__ signature!' ) except TypeError as e : AreEqual ( e . message , '__clrtype__() takes no arguments (1 given)' ) finally : AreEqual ( called , False ) called = False class MyType ( type , ) : def __clrtype__ ( not_self ) : global called called = True return super ( MyType , not_self ) . __clrtype__ ( ) class X ( object , ) : __metaclass__ = MyType AreEqual ( called , True ) called = False class MyType ( type , ) : def __clrtype__ ( self , stuff ) : global called called = True return super ( MyType , self ) . __clrtype__ ( ) try : class X ( object , ) : __metaclass__ = MyType Fail ( 'Bad __clrtype__ signature!' ) except TypeError as e : AreEqual ( e . message , '__clrtype__() takes exactly 2 arguments (1 given)' ) finally : AreEqual ( called , False )
define the __clrtype__ function which has a bad method signature and see what happens .