[docs] Error in the documentation for unittest

Daniel Obermiller dobermiller at gmail.com
Tue Aug 12 03:05:53 CEST 2014

In the documentation for unittest here

This segment is not entirely correct

> Instead of unittest.main()
> <https://docs.python.org/2/library/unittest.html#unittest.main>, there
> are other ways to run the tests with a finer level of control, less terse
> output, and no requirement to be run from the command line. For example,
> the last two lines may be replaced with:
> suite = unittest.TestLoader().loadTestsFromTestCase(TestSequenceFunctions)unittest.TextTestRunner(verbosity=2).run(suite)
> Running the revised script from the interpreter or another script produces
> the following output:
> test_choice (__main__.TestSequenceFunctions) ... ok
> test_sample (__main__.TestSequenceFunctions) ... ok
> test_shuffle (__main__.TestSequenceFunctions) ... ok
> ----------------------------------------------------------------------
> Ran 3 tests in 0.110s
> OK
> This is not entirely accurate - in order to get that output from the
interpreter or another script I had to provide the stream as well, like so

 unittest.TextTestRunner(sys.stdout, verbosity=2).run(suite)


Dan Obermiller
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20140811/b662b9f9/attachment.html>

More information about the docs mailing list