class_docstr: Test equality and order comparisons for some simple cases.
class_docstr_tok: ["Test","equality","and","order","comparisons","for","some","simple","cases","."]
docstr: No default delegation between operations except __ne__()
docstr_tok: ["No","default","delegation","between","operations","except","__ne__","(",")"]
code: def test_other_delegation(self):
      """No default delegation between operations except __ne__()"""
      ops = (
          ("__eq__", lambda a, b: a == b),
          ("__lt__", lambda a, b: a < b),
          ("__le__", lambda a, b: a <= b),
          ("__gt__", lambda a, b: a > b),
          ("__ge__", lambda a, b: a >= b),
      )
      for name, func in ops:
          with self.subTest(name):
  
              def unexpected(*args):
                  self.fail("Unexpected operator method called")
  
              class C:
                  __ne__ = unexpected
  
              for other, _ in ops:
                  if other != name:
                      setattr(C, other, unexpected)
              if name == "__eq__":
                  self.assertIs(func(C(), object()), False)
              else:
                  self.assertRaises(TypeError, func, C(), object())
  
imports: import unittest
  from test.support import ALWAYS_EQ
  from fractions import Fraction
  from decimal import Decimal
label_desc: Use image node_id 6 for calling the ComparisonSimpleTest obj's underlying member method code with example usage: obj.test_other_delegation() without return types