From 7d7f5350c58b733488821002e66fb1feb57ceaa8 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 8 Mar 2017 09:33:36 +0100 Subject: [PATCH] Add test for utils.get_clipboard with empty clipboard --- tests/unit/utils/test_utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/unit/utils/test_utils.py b/tests/unit/utils/test_utils.py index 3c00ca0c7..12330aa73 100644 --- a/tests/unit/utils/test_utils.py +++ b/tests/unit/utils/test_utils.py @@ -825,6 +825,12 @@ class TestGetSetClipboard: def test_get(self): assert utils.get_clipboard() == 'mocked clipboard text' + @pytest.mark.parametrize('selection', [True, False]) + 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_unsupported_selection(self, clipboard_mock): clipboard_mock.supportsSelection.return_value = False with pytest.raises(utils.SelectionUnsupportedError):