code: def test_equality():
      instances = [b1, b2, b3, b21, Basic(b1, b1, b1), Basic]
      for i, b_i in enumerate(instances):
          for j, b_j in enumerate(instances):
              assert (b_i == b_j) == (i == j)
              assert (b_i != b_j) == (i != j)
  
      assert Basic() != []
      assert not (Basic() == [])
      assert Basic() != 0
      assert not (Basic() == 0)
  
      class Foo:
          """
          Class that is unaware of Basic, and relies on both classes returning
          the NotImplemented singleton for equivalence to evaluate to False.
  
          """
  
      b = Basic()
      foo = Foo()
  
      assert b != foo
      assert foo != b
      assert not b == foo
      assert not foo == b
  
      class Bar:
          """
          Class that considers itself equal to any instance of Basic, and relies
          on Basic returning the NotImplemented singleton in order to achieve
          a symmetric equivalence relation.
  
          """
  
          def __eq__(self, other):
              if isinstance(other, Basic):
                  return True
              return NotImplemented
  
          def __ne__(self, other):
              return not self == other
  
      bar = Bar()
  
      assert b == bar
      assert bar == b
      assert not b != bar
      assert not bar != b
  
imports: import collections
  from typing import TypeVar, Generic
  from sympy.assumptions.ask import Q
  from sympy.core.basic import Basic, Atom, as_Basic, _atomic, _aresame
  from sympy.core.containers import Tuple
  from sympy.core.function import Function, Lambda
  from sympy.core.numbers import I, pi, Float
  from sympy.core.singleton import S
  from sympy.core.symbol import symbols, Symbol, Dummy
  from sympy.concrete.summations import Sum
  from sympy.functions.elementary.trigonometric import cos, sin
  from sympy.functions.special.gamma_functions import gamma
  from sympy.integrals.integrals import Integral
  from sympy.functions.elementary.exponential import exp
  from sympy.testing.pytest import raises, warns_deprecated_sympy
label_desc: Use image node_id 4 for calling a global function with example usage: test_equality() and returns: NotImplemented, unknown, True