Esempio n. 1
0
 def test_fallback_without_selection(self):
     with pytest.raises(ValueError):
         utils.get_clipboard(fallback=True)
Esempio n. 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'
Esempio n. 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
Esempio n. 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)
Esempio n. 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)
Esempio n. 6
0
 def test_fallback_without_selection(self):
     with pytest.raises(ValueError):
         utils.get_clipboard(fallback=True)
Esempio n. 7
0
 def test_get(self):
     assert utils.get_clipboard() == 'mocked clipboard text'
Esempio n. 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
Esempio n. 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'
Esempio n. 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)
Esempio n. 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)
Esempio n. 12
0
 def test_get(self):
     assert utils.get_clipboard() == 'mocked clipboard text'