ilogue/fexpect — pull request #24 by robertcarr (2014-06-05 16:33:34+00:00)
Title: Mangle expections to avoid matching line twice

After a succesful match mangle the matched expectation to avoid
a second match. This allows you to match the same string multiple times
with different responses.

From pexpect docs:
expect(self, pattern, timeout=-1, searchwindowsize=None)

If you pass a list of patterns and more than one matches, the first
match
in the stream is chosen. If more than one pattern matches at that point,
the leftmost in the pattern list is chosen. For example::

# the input is 'foobar'
index = p.expect (['bar', 'foo', 'foobar'])
# returns 1 ('foo') even though 'foobar' is a "better" match