コード例 #1
0
ファイル: matchers.py プロジェクト: Alexandr-Galko/samba
 def match(self, matchee):
     try:
         result = matchee()
         return Mismatch('%r returned %r' % (matchee, result))
     # Catch all exceptions: Raises() should be able to match a
     # KeyboardInterrupt or SystemExit.
     except:
         if self.exception_matcher:
             mismatch = self.exception_matcher.match(sys.exc_info())
             if not mismatch:
                 return
         else:
             mismatch = None
         # The exception did not match, or no explicit matching logic was
         # performed. If the exception is a non-user exception (that is, not
         # a subclass of Exception on Python 2.5+) then propogate it.
         if isbaseexception(sys.exc_info()[1]):
             raise
         return mismatch
コード例 #2
0
ファイル: matchers.py プロジェクト: fendouzhe660/dd-wrt
 def match(self, matchee):
     try:
         result = matchee()
         return Mismatch('%r returned %r' % (matchee, result))
     # Catch all exceptions: Raises() should be able to match a
     # KeyboardInterrupt or SystemExit.
     except:
         if self.exception_matcher:
             mismatch = self.exception_matcher.match(sys.exc_info())
             if not mismatch:
                 return
         else:
             mismatch = None
         # The exception did not match, or no explicit matching logic was
         # performed. If the exception is a non-user exception (that is, not
         # a subclass of Exception on Python 2.5+) then propogate it.
         if isbaseexception(sys.exc_info()[1]):
             raise
         return mismatch