[CLN] tests initial merge

This commit is contained in:
Benedek Racz 2020-01-25 16:59:19 +01:00
parent 1fc42b5b84
commit a9471a94e6
3 changed files with 10 additions and 6 deletions

View File

@ -22,8 +22,8 @@ import wexpect
import unittest
from . import PexpectTestCase
class SplitCommandLineTestCase(PexpectTestCase.PexpectTestCase):
def testSplitSizes(self):
class TestCaseSplitCommandLine(PexpectTestCase.PexpectTestCase):
def test_split_sizes(self):
self.assertEqual(len(wexpect.split_command_line(r'')), 0)
self.assertEqual(len(wexpect.split_command_line(r'one')), 1)
self.assertEqual(len(wexpect.split_command_line(r'one two')), 2)
@ -34,7 +34,7 @@ class SplitCommandLineTestCase(PexpectTestCase.PexpectTestCase):
self.assertEqual(len(wexpect.split_command_line(r'one\"one')), 1)
self.assertEqual(len(wexpect.split_command_line(r"This^' is a^'^ test")), 3)
def testJoinArgs(self):
def test_join_args(self):
cmd = 'foo bar "b a z"'
cmd2 = wexpect.join_args(wexpect.split_command_line(cmd))
self.assertEqual(cmd2, cmd)
@ -46,4 +46,4 @@ class SplitCommandLineTestCase(PexpectTestCase.PexpectTestCase):
if __name__ == '__main__':
unittest.main()
suite = unittest.makeSuite(SplitCommandLineTestCase,'test')
suite = unittest.makeSuite(TestCaseSplitCommandLine,'test')

View File

@ -33,6 +33,8 @@ import unittest
from . import PexpectTestCase
class InteractTestCase(PexpectTestCase.PexpectTestCase):
@unittest.skipIf(not hasattr(wexpect.spawn, 'interact'), "spawn does not support runtime interact switching.")
def test_interact(self):
# Path of cmd executable:
cmd_exe = 'cmd'
@ -54,7 +56,8 @@ class InteractTestCase(PexpectTestCase.PexpectTestCase):
p.stop_interact()
self.assertEqual('hello', p.before.splitlines()[1])
@unittest.skipIf(not hasattr(wexpect.spawn, 'interact'), "spawn does not support runtime interact switching.")
def test_interact_dead(self):
# Path of cmd executable:
echo = 'echo hello'

View File

@ -198,10 +198,11 @@ class TestCaseMisc(PexpectTestCase.PexpectTestCase):
def test_isalive(self):
" check isalive() before and after EOF. (True, False) "
child = wexpect.spawn('cat')
assert child.isalive() is True
self.assertTrue(child.isalive())
child.sendeof()
child.expect(wexpect.EOF)
assert child.isalive() is False
self.assertFalse(child.isalive())
def test_bad_type_in_expect(self):
" expect() does not accept dictionary arguments. "