def summarize(self, out, verbose=None):
string_io = sio.StringIO()<EOL>old_stdout = sys.stdout<EOL>sys.stdout = string_io<EOL>try:<EOL><INDENT>if verbose is None:<EOL><INDENT>verbose = self._verbose<EOL><DEDENT>notests = []<EOL>passed = []<EOL>failed = []<EOL>totalt = totalf = <NUM_LIT:0><EOL>for x in self._name2ft.items():<EOL><INDENT>name, (f, t) = x<EOL>assert f <= t<EOL>totalt += t<EOL>totalf += f<EOL>if t == <NUM_LIT:0>:<EOL><INDENT>notests.append(name)<EOL><DEDENT>elif f == <NUM_LIT:0>:<EOL><INDENT>passed.append( (name, t) )<EOL><DEDENT>else:<EOL><INDENT>failed.append(x)<EOL><DEDENT><DEDENT>if verbose:<EOL><INDENT>if notests:<EOL><INDENT>print(len(notests), "<STR_LIT>")<EOL>notests.sort()<EOL>for thing in notests:<EOL><INDENT>print("<STR_LIT:U+0020>", thing)<EOL><DEDENT><DEDENT>if passed:<EOL><INDENT>print(len(passed), "<STR_LIT>")<EOL>passed.sort()<EOL>for thing, count in passed:<EOL><INDENT>print("<STR_LIT>" % (count, thing))<EOL><DEDENT><DEDENT><DEDENT>if failed:<EOL><INDENT>print(self.DIVIDER)<EOL>print(len(failed), "<STR_LIT>")<EOL>failed.sort()<EOL>for thing, (f, t) in failed:<EOL><INDENT>print("<STR_LIT>" % (f, t, thing))<EOL><DEDENT><DEDENT>if verbose:<EOL><INDENT>print(totalt, "<STR_LIT>", len(self._name2ft), "<STR_LIT>")<EOL>print(totalt - totalf, "<STR_LIT>", totalf, "<STR_LIT>")<EOL><DEDENT>if totalf:<EOL><INDENT>print("<STR_LIT>", totalf, "<STR_LIT>")<EOL><DEDENT>elif verbose:<EOL><INDENT>print("<STR_LIT>")<EOL><DEDENT>res = TestResults(totalf, totalt)<EOL><DEDENT>finally:<EOL><INDENT>sys.stdout = old_stdout<EOL><DEDENT>out(string_io.getvalue())<EOL>return res<EOL>
Print a summary of all the test cases that have been run by
this DocTestRunner, and return a tuple `(f, t)`, where `f` is
the total number of failed examples, and `t` is the total
number of tried examples.

The optional `verbose` argument controls how detailed the
summary is.  If the verbosity is not specified, then the
DocTestRunner's verbosity is used.