Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# -*- coding: utf-8 -*-
import unittest
import random
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
import pyperclip
from pyperclip import CYGWIN, WINDOWS, PBCOPY_PBPASTE, XCLIP, XSEL, KLIPPER, PYQT4, GTK
import platform
RUNNING_PY2 = '2' == platform.python_version_tuple()[0]
ALL_FUNCTION_SETS = (CYGWIN, WINDOWS, PBCOPY_PBPASTE, XCLIP, XSEL, KLIPPER, PYQT4, GTK)
# The user can specify which set of copy/paste functions to use instead of the default. The names are given as strings in OVERRIDE_FUNCTION_SET.
OVERRIDE_FUNCTION_SET = None
if len(sys.argv) > 1:
OVERRIDE_FUNCTION_SET = sys.argv[1]
assert OVERRIDE_FUNCTION_SET in ALL_FUNCTION_SETS, 'Function set specified must be one of: %s' % (ALL_FUNCTION_SETS)
if OVERRIDE_FUNCTION_SET is not None:
pyperclip.setFunctions(OVERRIDE_FUNCTION_SET)
class TestCopyPaste(unittest.TestCase):
def test_copyPaste(self):
#pyVersion = '%s.%s.%s' % (sys.version_info[0], sys.version_info[1], sys.version_info[2])
#print('Testing on: Python %s - %s' % (pyVersion, pyperclip._functions))
msg = 'The quick brown fox jumped over the yellow lazy dog.'
pyperclip.copy(msg)