コード例 #1
0
 def test_fallback_without_selection(self):
     with pytest.raises(ValueError):
         utils.get_clipboard(fallback=True)
コード例 #2
0
 def test_get_unsupported_selection_fallback(self, clipboard_mock):
     clipboard_mock.supportsSelection.return_value = False
     clipboard_mock.text.return_value = 'text'
     assert utils.get_clipboard(selection=True, fallback=True) == 'text'
コード例 #3
0
 def test_get_fake_clipboard(self, selection):
     utils.fake_clipboard = 'fake clipboard text'
     utils.get_clipboard(selection=selection)
     assert utils.fake_clipboard is None
コード例 #4
0
 def test_get_empty(self, clipboard_mock, selection):
     clipboard_mock.text.return_value = ''
     with pytest.raises(utils.ClipboardEmptyError):
         utils.get_clipboard(selection=selection)
コード例 #5
0
 def test_get_unsupported_selection(self, clipboard_mock):
     clipboard_mock.supportsSelection.return_value = False
     with pytest.raises(utils.SelectionUnsupportedError):
         utils.get_clipboard(selection=True)
コード例 #6
0
ファイル: test_utils.py プロジェクト: phansch/qutebrowser
 def test_fallback_without_selection(self):
     with pytest.raises(ValueError):
         utils.get_clipboard(fallback=True)
コード例 #7
0
 def test_get(self):
     assert utils.get_clipboard() == 'mocked clipboard text'
コード例 #8
0
ファイル: test_utils.py プロジェクト: phansch/qutebrowser
 def test_get_fake_clipboard(self, selection):
     utils.fake_clipboard = 'fake clipboard text'
     utils.get_clipboard(selection=selection)
     assert utils.fake_clipboard is None
コード例 #9
0
ファイル: test_utils.py プロジェクト: phansch/qutebrowser
 def test_get_unsupported_selection_fallback(self, clipboard_mock):
     clipboard_mock.supportsSelection.return_value = False
     clipboard_mock.text.return_value = 'text'
     assert utils.get_clipboard(selection=True, fallback=True) == 'text'
コード例 #10
0
ファイル: test_utils.py プロジェクト: phansch/qutebrowser
 def test_get_unsupported_selection(self, clipboard_mock):
     clipboard_mock.supportsSelection.return_value = False
     with pytest.raises(utils.SelectionUnsupportedError):
         utils.get_clipboard(selection=True)
コード例 #11
0
ファイル: test_utils.py プロジェクト: phansch/qutebrowser
 def test_get_empty(self, clipboard_mock, selection):
     clipboard_mock.text.return_value = ''
     with pytest.raises(utils.ClipboardEmptyError):
         utils.get_clipboard(selection=selection)
コード例 #12
0
ファイル: test_utils.py プロジェクト: phansch/qutebrowser
 def test_get(self):
     assert utils.get_clipboard() == 'mocked clipboard text'