'Match the collected log lines against the regular expression
self.expected_log_pat, and compare the extracted group values to
the expected_values list of tuples.'

def assert_log_lines(self, expected_values, stream=None):

    stream = (stream or self.stream)
    pat = re.compile(self.expected_log_pat)
    try:
        stream.reset()
        actual_lines = stream.readlines()
    except AttributeError:
        actual_lines = stream.getvalue().splitlines()
    self.assertEqual(len(actual_lines), len(expected_values))
    for (actual, expected) in zip(actual_lines, expected_values):
        match = pat.search(actual)
        if (not match):
            self.fail(('Log    line    does    not    match    expected    pattern:\n' + actual))
        self.assertEqual(tuple(match.groups()), expected)
    s = stream.read()
    if s:
        self.fail(('Remaining    output    at    end    of    log    stream:\n' + s))
