class_docstr: Support class for stubbing methods out for unit testing.
  
  Sample Usage:
  
  You want os.path.exists() to always return true during testing.
  
     stubs = StubOutForTesting()
     stubs.Set(os.path, 'exists', lambda x: 1)
       ...
     stubs.CleanUp()
  
  The above changes os.path.exists into a lambda that returns 1.  Once
  the ... part of the code finishes, the CleanUp() looks up the old
  value of os.path.exists and restores it.
class_docstr_tok: ["Support","class","for","stubbing","methods","out","for","unit","testing",".","Sample","Usage",":","You","want","os.path.exists","(",")","to","always","return","true","during","testing",".","stubs","=","StubOutForTesting","(",")","stubs.Set","(","os.path",",","'exists","'",",","lambda","x",":","1",")","...","stubs.CleanUp","(",")","The","above","changes","os.path.exists","into","a","lambda","that","returns","1",".","Once","the","...","part","of","the","code","finishes",",","the","CleanUp","(",")","looks","up","the","old","value","of","os.path.exists","and","restores","it","."]
docstr: Do not rely on the destructor to undo your stubs.
  
  You cannot guarantee exactly when the destructor will get called without
  relying on implementation details of a Python VM that may change.
docstr_tok: ["Do","not","rely","on","the","destructor","to","undo","your","stubs",".","You","can","not","guarantee","exactly","when","the","destructor","will","get","called","without","relying","on","implementation","details","of","a","Python","VM","that","may","change","."]
code: def __del__(self):
      """Do not rely on the destructor to undo your stubs.
  
      You cannot guarantee exactly when the destructor will get called without
      relying on implementation details of a Python VM that may change.
      """
      self.CleanUp()
  
imports: import atexit
  import os
  import sys
  import tempfile
  from absl import app
  from absl.testing.absltest import *
  from tensorflow.python.framework import errors
  from tensorflow.python.lib.io import file_io
  from tensorflow.python.platform import benchmark
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.util import tf_decorator
  from tensorflow.python.util import tf_inspect
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 2 for calling the StubOutForTesting obj's underlying member method code with example usage: obj.__del__() without return types