コード例 #1
0
ファイル: test_exception.py プロジェクト: AIdrifter/samba
 def raise_keyb_from_match():
     if sys.version_info > (2, 5):
         matcher = Raises(MatchesException(Exception))
     else:
         # On Python 2.4 KeyboardInterrupt is a StandardError subclass
         # but should propogate from less generic exception matchers
         matcher = Raises(MatchesException(EnvironmentError))
     matcher.match(self.raiser)
コード例 #2
0
 def test_KeyboardInterrupt_propogates(self):
     # The default 'it raised' propogates KeyboardInterrupt.
     match_keyb = Raises(MatchesException(KeyboardInterrupt))
     def raise_keyb_from_match():
         matcher = Raises()
         matcher.match(self.raiser)
     self.assertThat(raise_keyb_from_match, match_keyb)
コード例 #3
0
 def test_KeyboardInterrupt_match_Exception_propogates(self):
     # If the raised exception isn't matched, and it is not a subclass of
     # Exception, it is propogated.
     match_keyb = Raises(MatchesException(KeyboardInterrupt))
     def raise_keyb_from_match():
         matcher = Raises(MatchesException(Exception))
         matcher.match(self.raiser)
     self.assertThat(raise_keyb_from_match, match_keyb)
コード例 #4
0
class TestRaisesInterface(TestCase, TestMatchersInterface):

    matches_matcher = Raises()
    def boom():
        raise Exception('foo')
    matches_matches = [boom]
    matches_mismatches = [lambda:None]

    # Tricky to get function objects to render constantly, and the interfaces
    # helper uses assertEqual rather than (for instance) DocTestMatches.
    str_examples = []

    describe_examples = []
コード例 #5
0
ファイル: test_exception.py プロジェクト: hmz20000/MittOS-CFQ
 def raise_keyb_from_match():
     if sys.version_info > (2, 5):
         matcher = Raises(MatchesException(Exception))
     else:
         # On Python 2.4 KeyboardInterrupt is a StandardError subclass
         # but should propogate from less generic exception matchers
         matcher = Raises(MatchesException(EnvironmentError))
     matcher.match(self.raiser)
コード例 #6
0
ファイル: test_exception.py プロジェクト: hmz20000/MittOS-CFQ
    def test_KeyboardInterrupt_match_Exception_propogates(self):
        # If the raised exception isn't matched, and it is not a subclass of
        # Exception, it is propogated.
        match_keyb = Raises(MatchesException(KeyboardInterrupt))

        def raise_keyb_from_match():
            if sys.version_info > (2, 5):
                matcher = Raises(MatchesException(Exception))
            else:
                # On Python 2.4 KeyboardInterrupt is a StandardError subclass
                # but should propogate from less generic exception matchers
                matcher = Raises(MatchesException(EnvironmentError))
            matcher.match(self.raiser)

        self.assertThat(raise_keyb_from_match, match_keyb)
コード例 #7
0
 def raise_keyb_from_match():
     matcher = Raises(MatchesException(Exception))
     matcher.match(self.raiser)
コード例 #8
0
 def raise_keyb_from_match():
     matcher = Raises()
     matcher.match(self.raiser)
コード例 #9
0
 def test_KeyboardInterrupt_matched(self):
     # When KeyboardInterrupt is matched, it is swallowed.
     matcher = Raises(MatchesException(KeyboardInterrupt))
     self.assertThat(self.raiser, matcher)