コード例 #1
0
ファイル: assertions_test.py プロジェクト: Yelp/Testify
    def test_unexpected_exception_passes_through(self):
        class DifferentException(Exception):
            pass

        with assertions.assert_raises(DifferentException):
            with assertions.assert_raises_exactly(self.MyException, "first", "second"):
                raise DifferentException("first", "second")
コード例 #2
0
ファイル: assertions_test.py プロジェクト: Yelp/Testify
    def test_fails_with_different_class(self):
        class SpecialException(self.MyException):
            pass

        with assertions.assert_raises(AssertionError):
            with assertions.assert_raises_exactly(self.MyException, "first", "second"):
                raise SpecialException("first", "second")
コード例 #3
0
    def test_unexpected_exception_passes_through(self):
        class DifferentException(Exception):
            pass

        with assertions.assert_raises(DifferentException):
            with assertions.assert_raises_exactly(self.MyException, "first",
                                                  "second"):
                raise DifferentException("first", "second")
コード例 #4
0
    def test_fails_with_different_class(self):
        class SpecialException(self.MyException):
            pass

        with assertions.assert_raises(AssertionError):
            with assertions.assert_raises_exactly(self.MyException, "first",
                                                  "second"):
                raise SpecialException("first", "second")
コード例 #5
0
 def test_fails_with_vague_class(self):
     with assertions.assert_raises(AssertionError):
         with assertions.assert_raises_exactly(Exception, "first",
                                               "second"):
             raise self.MyException("first", "second")
コード例 #6
0
 def test_fails_with_wrong_value(self):
     with assertions.assert_raises(AssertionError):
         with assertions.assert_raises_exactly(self.MyException, "first",
                                               "second"):
             raise self.MyException("red", "blue")
コード例 #7
0
 def test_passes_when_correct_exception_is_raised(self):
     with assertions.assert_raises_exactly(self.MyException, "first",
                                           "second"):
         raise self.MyException("first", "second")
コード例 #8
0
ファイル: assertions_test.py プロジェクト: whoislp/Testify
 def test_assert_falsey_with_msg(self):
     with assertions.assert_raises_exactly(AssertionError, 'my_msg'):
         assert_falsey(1, message='my_msg')
コード例 #9
0
ファイル: assertions_test.py プロジェクト: whoislp/Testify
 def test_assert_truthy_with_msg(self):
     with assertions.assert_raises_exactly(AssertionError, 'my_msg'):
         assert_truthy(0, message='my_msg')
コード例 #10
0
ファイル: assertions_test.py プロジェクト: pyarnold/Testify
 def test_fails_with_vague_class(self):
     with assertions.assert_raises(AssertionError):
         with assertions.assert_raises_exactly(Exception, "first", "second"):
             raise self.MyException("first", "second")
コード例 #11
0
ファイル: assertions_test.py プロジェクト: pyarnold/Testify
 def test_fails_with_wrong_value(self):
     with assertions.assert_raises(AssertionError):
         with assertions.assert_raises_exactly(self.MyException, "first", "second"):
             raise self.MyException("red", "blue")
コード例 #12
0
ファイル: assertions_test.py プロジェクト: pyarnold/Testify
 def test_passes_when_correct_exception_is_raised(self):
     with assertions.assert_raises_exactly(self.MyException, "first", "second"):
         raise self.MyException("first", "second")
コード例 #13
0
ファイル: assertions_test.py プロジェクト: Yelp/Testify
 def test_assert_falsey_with_msg(self):
     with assertions.assert_raises_exactly(AssertionError, 'my_msg'):
         assert_falsey(1, message='my_msg')
コード例 #14
0
ファイル: assertions_test.py プロジェクト: Yelp/Testify
 def test_assert_truthy_with_msg(self):
     with assertions.assert_raises_exactly(AssertionError, 'my_msg'):
         assert_truthy(0, message='my_msg')