Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
'''
from __future__ import print_function
import pexpect
import unittest
from . import PexpectTestCase
import time
import sys
from ptyprocess import ptyprocess
ptyprocess._make_eof_intr()
if sys.version_info[0] >= 3:
def byte(i):
return bytes([i])
else:
byte = chr
class TestCtrlChars(PexpectTestCase.PexpectTestCase):
def setUp(self):
super(TestCtrlChars, self).setUp()
self.getch_cmd = self.PYTHONBIN + ' getch.py'
def test_control_chars(self):
'''This tests that we can send all 256 8-bit characters to a child
process.'''
child = pexpect.spawn(self.getch_cmd, echo=False, timeout=5)