'Return True iff the actual output from an example (`got`)
matches the expected output (`want`).  These strings are
always considered to match if they are identical; but
depending on what option flags the test runner is using,
several non-exact match types are also possible.  See the
documentation for `TestRunner` for more information about
option flags.'

def check_output(self, want, got, optionflags):

    if (got == want):
        return True
    matches = self.num_got_rgx.finditer(got)
    numbers_got = [match.group(1) for match in matches]
    matches = self.num_want_rgx.finditer(want)
    numbers_want = [match.group(1) for match in matches]
    if (len(numbers_got) != len(numbers_want)):
        return False
    if (len(numbers_got) > 0):
        nw_ = []
        for (ng, nw) in zip(numbers_got, numbers_want):
            if ('...' in nw):
                nw_.append(ng)
                continue
            else:
                nw_.append(nw)
            if (abs((float(ng) - float(nw))) > 1e-05):
                return False
        got = self.num_got_rgx.sub('%s', got)
        got = (got % tuple(nw_))
    if (not (optionflags & pdoctest.DONT_ACCEPT_BLANKLINE)):
        want = re.sub(('(?m)^%s\\s*?$' % re.escape(pdoctest.BLANKLINE_MARKER)), '', want)
        got = re.sub('(?m)^\\s*?$', '', got)
        if (got == want):
            return True
    if (optionflags & pdoctest.NORMALIZE_WHITESPACE):
        got = '    '.join(got.split())
        want = '    '.join(want.split())
        if (got == want):
            return True
    if (optionflags & pdoctest.ELLIPSIS):
        if pdoctest._ellipsis_match(want, got):
            return True
    return False
