(self)
| 66 | assert the_old_way == the_new_way, len(the_old_way) - len(the_new_way) |
| 67 | |
| 68 | def test_expect_exact(self): |
| 69 | the_old_way = subprocess.Popen(args=['ls', '-l', '/bin'], |
| 70 | stdout=subprocess.PIPE).communicate()[0].rstrip() |
| 71 | p = PopenSpawn('ls -l /bin') |
| 72 | the_new_way = b'' |
| 73 | while 1: |
| 74 | i = p.expect_exact([b'\n', pexpect.EOF]) |
| 75 | the_new_way = the_new_way + p.before |
| 76 | if i == 1: |
| 77 | break |
| 78 | the_new_way += b'\n' |
| 79 | the_new_way = the_new_way.rstrip() |
| 80 | |
| 81 | assert the_old_way == the_new_way, len(the_old_way) - len(the_new_way) |
| 82 | p = PopenSpawn('echo hello.?world') |
| 83 | i = p.expect_exact(b'.?') |
| 84 | self.assertEqual(p.before, b'hello') |
| 85 | self.assertEqual(p.after, b'.?') |
| 86 | |
| 87 | def test_expect_eof(self): |
| 88 | the_old_way = subprocess.Popen(args=['ls', '-l', '/bin'], |
nothing calls this directly
no test coverage detected