コード例 #1
0
ファイル: test_utils.py プロジェクト: phansch/qutebrowser
 def test_unrelated_exception(self):
     """Test with an unrelated exception."""
     with pytest.raises(Exception):
         utils.raises(ValueError, self.do_raise)
コード例 #2
0
ファイル: test_utils.py プロジェクト: phansch/qutebrowser
 def test_no_args_true(self):
     """Test with no args and an exception which gets raised."""
     assert utils.raises(Exception, self.do_raise)
コード例 #3
0
ファイル: test_utils.py プロジェクト: phansch/qutebrowser
 def test_no_args_false(self):
     """Test with no args and an exception which does not get raised."""
     assert not utils.raises(Exception, self.do_nothing)
コード例 #4
0
ファイル: test_utils.py プロジェクト: vyp/qutebrowser
 def test_raises_multiple_exc_false(self):
     """Test raises with multiple exceptions which do not get raised."""
     assert not utils.raises((ValueError, TypeError), int, "1")
コード例 #5
0
ファイル: test_utils.py プロジェクト: phansch/qutebrowser
 def test_raises_int(self, exception, value, expected):
     """Test raises with a single exception which gets raised."""
     assert utils.raises(exception, int, value) == expected
コード例 #6
0
ファイル: test_utils.py プロジェクト: vyp/qutebrowser
 def test_raises_single_exc_false(self):
     """Test raises with a single exception which does not get raised."""
     assert not utils.raises(ValueError, int, "1")
コード例 #7
0
ファイル: test_utils.py プロジェクト: vyp/qutebrowser
 def test_raises_multiple_exc_true(self):
     """Test raises with multiple exceptions which get raised."""
     assert utils.raises((ValueError, TypeError), int, "a")
     assert utils.raises((ValueError, TypeError), int, None)
コード例 #8
0
 def test_raises_multiple_exc_false(self):
     """Test raises with multiple exceptions which do not get raised."""
     assert not utils.raises((ValueError, TypeError), int, '1')
コード例 #9
0
ファイル: test_utils.py プロジェクト: vyp/qutebrowser
 def test_raises_single_exc_true(self):
     """Test raises with a single exception which gets raised."""
     assert utils.raises(ValueError, int, "a")
コード例 #10
0
 def test_raises_single_exc_false(self):
     """Test raises with a single exception which does not get raised."""
     assert not utils.raises(ValueError, int, '1')
コード例 #11
0
 def test_raises_multiple_exc_true(self):
     """Test raises with multiple exceptions which get raised."""
     assert utils.raises((ValueError, TypeError), int, 'a')
     assert utils.raises((ValueError, TypeError), int, None)
コード例 #12
0
 def test_raises_single_exc_true(self):
     """Test raises with a single exception which gets raised."""
     assert utils.raises(ValueError, int, 'a')
コード例 #13
0
 def test_unrelated_exception(self):
     """Test with an unrelated exception."""
     with pytest.raises(Exception):
         utils.raises(ValueError, self.do_raise)
コード例 #14
0
 def test_no_args_false(self):
     """Test with no args and an exception which does not get raised."""
     assert not utils.raises(Exception, self.do_nothing)
コード例 #15
0
 def test_no_args_true(self):
     """Test with no args and an exception which gets raised."""
     assert utils.raises(Exception, self.do_raise)
コード例 #16
0
 def test_raises_int(self, exception, value, expected):
     """Test raises with a single exception which gets raised."""
     assert utils.raises(exception, int, value) == expected