class_docstr: Test all the ways that we can change/shadow globals/builtins.
class_docstr_tok: ["Test","all","the","ways","that","we","can","change\/shadow","globals\/builtins","."]
code: def test_cannot_replace_builtins_dict_while_active(self):
      def foo():
          x = range(3)
          yield len(x)
          yield len(x)
  
      self.configure_func(foo)
  
      g = foo()
      self.assertEqual(next(g), 3)
      with swap_item(globals(), "__builtins__", {"len": lambda x: 7}):
          self.assertEqual(next(g), 3)
  
imports: import builtins
  import sys
  import unittest
  from test.support import swap_item, swap_attr
label_desc: Use image node_id 8 for calling the RebindBuiltinsTests obj's underlying member method code with example usage: obj.test_cannot_replace_builtins_dict_while_active() without return types