def test_fallback_without_selection(self): with pytest.raises(ValueError): utils.get_clipboard(fallback=True)
def test_get_fake_clipboard(self, selection): utils.fake_clipboard = 'fake clipboard text' utils.get_clipboard(selection=selection) assert utils.fake_clipboard is None
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'
def test_get_unsupported_selection(self, clipboard_mock): clipboard_mock.supportsSelection.return_value = False with pytest.raises(utils.SelectionUnsupportedError): utils.get_clipboard(selection=True)
def test_get_empty(self, clipboard_mock, selection): clipboard_mock.text.return_value = '' with pytest.raises(utils.ClipboardEmptyError): utils.get_clipboard(selection=selection)
def test_get(self): assert utils.get_clipboard() == 'mocked clipboard text'