def test_oldstyle_eq():
 class x:
  pass
 inst = type(x())
 global cmpCalled
 cmpCalled = False
 class C:
  def __init__(self, value):
   self.value = value
  def __cmp__(self, other):
   global cmpCalled
   cmpCalled = True
   return (self.value - other.value)
 class D:
  def __init__(self, value):
   self.value = value
  def __cmp__(self, other):
   global cmpCalled
   cmpCalled = True
   return (self.value - other.value)
 class C2(C, ):
  pass
 class D2(D, ):
  pass
 AreEqual(inst.__eq__(C(3.0), C(4.5)), NotImplemented)
 AreEqual(inst.__eq__(C(3.0), C2(4.5)), NotImplemented)
 AreEqual(inst.__eq__(C(3.0), D(4.5)), NotImplemented)
 AreEqual(cmpCalled, False)

def test_oldstyle_eq ( ) : class x : pass inst = type ( x ( ) ) global cmpCalled cmpCalled = False class C : def __init__ ( self , value ) : self . value = value def __cmp__ ( self , other ) : global cmpCalled cmpCalled = True return ( self . value - other . value ) class D : def __init__ ( self , value ) : self . value = value def __cmp__ ( self , other ) : global cmpCalled cmpCalled = True return ( self . value - other . value ) class C2 ( C , ) : pass class D2 ( D , ) : pass AreEqual ( inst . __eq__ ( C ( 3.0 ) , C ( 4.5 ) ) , NotImplemented ) AreEqual ( inst . __eq__ ( C ( 3.0 ) , C2 ( 4.5 ) ) , NotImplemented ) AreEqual ( inst . __eq__ ( C ( 3.0 ) , D ( 4.5 ) ) , NotImplemented ) AreEqual ( cmpCalled , False )
old style __eq__ shouldnt call __cmp__ .