def test_clrtype_returns_existing_python_types():
 global called
 class PySubType1(type, ):
  pass
 class PySubType2(PySubType1, ):
  pass
 class PySubType3(PySubType2, PySubType1, ):
  pass
 for x in [bool, buffer, type(range), type(''.index), type(BaseException), dict, type(Ellipsis), file, float, type(sys._getframe(0)), xrange, int, long, unicode, tuple, type((lambda : 3)), type(None), type(object.__str__), PySubType1, PySubType2, PySubType3]:
  called = False
  class MyType(type, ):
   def __clrtype__(self):
    global called
    called = True
    return x
  class X(object, ):
   __metaclass__ = MyType
  AreEqual(called, True)

def test_clrtype_returns_existing_python_types ( ) : global called class PySubType1 ( type , ) : pass class PySubType2 ( PySubType1 , ) : pass class PySubType3 ( PySubType2 , PySubType1 , ) : pass for x in [ bool , buffer , type ( range ) , type ( '' . index ) , type ( BaseException ) , dict , type ( Ellipsis ) , file , float , type ( sys . _getframe ( 0 ) ) , xrange , int , long , unicode , tuple , type ( ( lambda : 3 ) ) , type ( None ) , type ( object . __str__ ) , PySubType1 , PySubType2 , PySubType3 ] : called = False class MyType ( type , ) : def __clrtype__ ( self ) : global called called = True return x class X ( object , ) : __metaclass__ = MyType AreEqual ( called , True )
our implementation of __clrtype__ returns pure-python types instead of subclassing from type or system .