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: Reverses Set() calls, restoring things to their original definitions.
  
  This method is automatically called when the StubOutForTesting()
  object is deleted; there is no need to call it explicitly.
  
  It is okay to call UnsetAll() repeatedly, as later calls have no
  effect if no Set() calls have been made.
docstr_tok: ["Reverses","Set","(",")","calls",",","restoring","things","to","their","original","definitions",".","This","method","is","automatically","called","when","the","StubOutForTesting","(",")","object","is","deleted",";","there","is","no","need","to","call","it","explicitly",".","It","is","okay","to","call","UnsetAll","(",")","repeatedly",",","as","later","calls","have","no","effect","if","no","Set","(",")","calls","have","been","made","."]
code: def UnsetAll(self):
      """Reverses Set() calls, restoring things to their original definitions.
  
      This method is automatically called when the StubOutForTesting()
      object is deleted; there is no need to call it explicitly.
  
      It is okay to call UnsetAll() repeatedly, as later calls have no
      effect if no Set() calls have been made.
      """
      # Undo calls to Set() in reverse order, in case Set() was called on the
      # same arguments repeatedly (want the original call to be last one undone)
      for parent, old_child, child_name in reversed(self.cache):
          setattr(parent, child_name, old_child)
      self.cache = []
  
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 9 for calling the StubOutForTesting obj's underlying member method code with example usage: obj.UnsetAll() without return types