def test_searcher_re (self):
# This should be done programatically, if we copied and pasted output,
# there wouldnt be a whole lot to test, really, other than our ability
# to copy and paste correctly :-)
ss = pexpect.searcher_re ([
re.compile('this'), re.compile('that'),
re.compile('and'), re.compile('the'),
re.compile('other') ])
out = ('searcher_re:\n 0: re.compile("this")\n '
'1: re.compile("that")\n 2: re.compile("and")\n '
'3: re.compile("the")\n 4: re.compile("other")')
assert ss.__str__() == out, (ss.__str__(), out)
ss = pexpect.searcher_re ([
pexpect.TIMEOUT, re.compile('this'),
re.compile('that'), re.compile('and'),
pexpect.EOF,re.compile('other')
])
out = ('searcher_re:\n 0: TIMEOUT\n 1: re.compile("this")\n '
'2: re.compile("that")\n 3: re.compile("and")\n '
'4: EOF\n 5: re.compile("other")')
assert ss.__str__() == out, (ss.__str__(), out)
评论列表
文章目录