parameters: (cls, func)
return_statement: return new_method
docstring: Adds Mox cleanup code to any MoxTestBase method.
  
          Always unsets stubs after a test. Will verify all mocks for tests that
          otherwise pass.
  
          Args:
              cls: MoxTestBase or subclass; the class whose method we are
                                            altering.
              func: method; the method of the MoxTestBase test class we wish to
                            alter.
  
          Returns:
              The modified method.
docstring_summary: Adds Mox cleanup code to any MoxTestBase method.
docstring_tokens: Adds Mox cleanup code to any MoxTestBase method .
function: def CleanUpTest(cls, func):
          """Adds Mox cleanup code to any MoxTestBase method.
  
          Always unsets stubs after a test. Will verify all mocks for tests that
          otherwise pass.
  
          Args:
              cls: MoxTestBase or subclass; the class whose method we are
                                            altering.
              func: method; the method of the MoxTestBase test class we wish to
                            alter.
  
          Returns:
              The modified method.
          """
          def new_method(self, *args, **kwargs):
              mox_obj = getattr(self, 'mox', None)
              stubout_obj = getattr(self, 'stubs', None)
              cleanup_mox = False
              cleanup_stubout = False
              if mox_obj and isinstance(mox_obj, Mox):
                  cleanup_mox = True
              if stubout_obj and isinstance(stubout_obj,
                                            stubout.StubOutForTesting):
                  cleanup_stubout = True
              try:
                  func(self, *args, **kwargs)
              finally:
                  if cleanup_mox:
                      mox_obj.UnsetStubs()
                  if cleanup_stubout:
                      stubout_obj.UnsetAll()
                      stubout_obj.SmartUnsetAll()
              if cleanup_mox:
                  mox_obj.VerifyAll()
          new_method.__name__ = func.__name__
          new_method.__doc__ = func.__doc__
          new_method.__module__ = func.__module__
          return new_method
function_tokens: def CleanUpTest ( cls , func ) : def new_method ( self , * args , * * kwargs ) : mox_obj = getattr ( self , 'mox' , None ) stubout_obj = getattr ( self , 'stubs' , None ) cleanup_mox = False cleanup_stubout = False if mox_obj and isinstance ( mox_obj , Mox ) : cleanup_mox = True if stubout_obj and isinstance ( stubout_obj , stubout . StubOutForTesting ) : cleanup_stubout = True try : func ( self , * args , * * kwargs ) finally : if cleanup_mox : mox_obj . UnsetStubs ( ) if cleanup_stubout : stubout_obj . UnsetAll ( ) stubout_obj . SmartUnsetAll ( ) if cleanup_mox : mox_obj . VerifyAll ( ) new_method . __name__ = func . __name__ new_method . __doc__ = func . __doc__ new_method . __module__ = func . __module__ return new_method