From a7777a049dab6e3d4b99f8259ebfa39a31d32ae8 2013-11-04 19:17:03 From: Thomas Kluyver Date: 2013-11-04 19:17:03 Subject: [PATCH] Add simple smoketest for clipboard access --- diff --git a/IPython/lib/tests/test_clipboard.py b/IPython/lib/tests/test_clipboard.py new file mode 100644 index 0000000..2eb9a29 --- /dev/null +++ b/IPython/lib/tests/test_clipboard.py @@ -0,0 +1,20 @@ +import nose.tools as nt + +from IPython.core.error import TryNext +from IPython.lib.clipboard import ClipboardEmpty +from IPython.utils.py3compat import unicode_type + +def test_clipboard_get(): + # Smoketest for clipboard access - we can't easily guarantee that the + # clipboard is accessible and has something on it, but this tries to + # exercise the relevant code anyway. + try: + a = get_ipython().hooks.clipboard_get() + except ClipboardEmpty: + # Nothing in clipboard to get + pass + except TryNext: + # No clipboard access API available + pass + else: + nt.assert_is_instance(a, unicode_type)