| 1 |
from IPython.core.error import TryNext |
| 2 |
from IPython.lib.clipboard import ClipboardEmpty |
| 3 |
from IPython.testing.decorators import skip_if_no_x11 |
| 4 |
|
| 5 |
|
| 6 |
@skip_if_no_x11 |
| 7 |
def test_clipboard_get(): |
| 8 |
# Smoketest for clipboard access - we can't easily guarantee that the |
| 9 |
# clipboard is accessible and has something on it, but this tries to |
| 10 |
# exercise the relevant code anyway. |
| 11 |
try: |
| 12 |
a = get_ipython().hooks.clipboard_get() |
| 13 |
except ClipboardEmpty: |
| 14 |
# Nothing in clipboard to get |
| 15 |
pass |
| 16 |
except TryNext: |
| 17 |
# No clipboard access API available |
| 18 |
pass |
| 19 |
else: |
| 20 |
assert isinstance(a, str) |