summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/library/unittest.rst8
1 files changed, 6 insertions, 2 deletions
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst
index 2099bd1..e52f140 100644
--- a/Doc/library/unittest.rst
+++ b/Doc/library/unittest.rst
@@ -402,10 +402,14 @@ you can do it yourself::
def suite():
suite = unittest.TestSuite()
- suite.addTest(WidgetTestCase('test_default_size'))
- suite.addTest(WidgetTestCase('test_resize'))
+ suite.addTest(WidgetTestCase('test_default_widget_size'))
+ suite.addTest(WidgetTestCase('test_widget_resize'))
return suite
+ if __name__ == '__main__':
+ runner = unittest.TextTestRunner()
+ runner.run(suite())
+
You can place the definitions of test cases and test suites in the same modules
as the code they are to test (such as :file:`widget.py`), but there are several
advantages to placing the test code in a separate module, such as