code: def test_block_fallback(self):
      # blocking fallback with __contains__ = None
      class ByContains(object):
          def __contains__(self, other):
              return False
  
      c = ByContains()
  
      class BlockContains(ByContains):
          """Is not a container
  
          This class is a perfectly good iterable (as tested by
          list(bc)), as well as inheriting from a perfectly good
          container, but __contains__ = None prevents the usual
          fallback to iteration in the container protocol. That
          is, normally, 0 in bc would fall back to the equivalent
          of any(x==0 for x in bc), but here it's blocked from
          doing so.
          """
  
          def __iter__(self):
              while False:
                  yield None
  
          __contains__ = None
  
      bc = BlockContains()
      self.assertFalse(0 in c)
      self.assertFalse(0 in list(bc))
      self.assertRaises(TypeError, lambda: 0 in bc)
  
file_path: cpython/Lib/test/test_contains.py
imports: from collections import deque
  import unittest
  from test.support import NEVER_EQ
label_desc: Use image node_id 4 for calling the TestContains obj's underlying member method code with example usage: obj.test_block_fallback() and returns: False