示例#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
 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
 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
 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
 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
 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
 def test_get(self):
     assert utils.get_clipboard() == 'mocked clipboard text'