]>
Commit | Line | Data |
---|---|---|
4710c53d | 1 | """\r |
2 | Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's\r | |
3 | Smalltalk testing framework.\r | |
4 | \r | |
5 | This module contains the core framework classes that form the basis of\r | |
6 | specific test cases and suites (TestCase, TestSuite etc.), and also a\r | |
7 | text-based utility class for running the tests and reporting the results\r | |
8 | (TextTestRunner).\r | |
9 | \r | |
10 | Simple usage:\r | |
11 | \r | |
12 | import unittest\r | |
13 | \r | |
14 | class IntegerArithmenticTestCase(unittest.TestCase):\r | |
15 | def testAdd(self): ## test method names begin 'test*'\r | |
16 | self.assertEqual((1 + 2), 3)\r | |
17 | self.assertEqual(0 + 1, 1)\r | |
18 | def testMultiply(self):\r | |
19 | self.assertEqual((0 * 10), 0)\r | |
20 | self.assertEqual((5 * 8), 40)\r | |
21 | \r | |
22 | if __name__ == '__main__':\r | |
23 | unittest.main()\r | |
24 | \r | |
25 | Further information is available in the bundled documentation, and from\r | |
26 | \r | |
27 | http://docs.python.org/library/unittest.html\r | |
28 | \r | |
29 | Copyright (c) 1999-2003 Steve Purcell\r | |
30 | Copyright (c) 2003-2010 Python Software Foundation\r | |
31 | This module is free software, and you may redistribute it and/or modify\r | |
32 | it under the same terms as Python itself, so long as this copyright message\r | |
33 | and disclaimer are retained in their original form.\r | |
34 | \r | |
35 | IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,\r | |
36 | SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF\r | |
37 | THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\r | |
38 | DAMAGE.\r | |
39 | \r | |
40 | THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT\r | |
41 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\r | |
42 | PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS,\r | |
43 | AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,\r | |
44 | SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.\r | |
45 | """\r | |
46 | \r | |
47 | __all__ = ['TestResult', 'TestCase', 'TestSuite',\r | |
48 | 'TextTestRunner', 'TestLoader', 'FunctionTestCase', 'main',\r | |
49 | 'defaultTestLoader', 'SkipTest', 'skip', 'skipIf', 'skipUnless',\r | |
50 | 'expectedFailure', 'TextTestResult', 'installHandler',\r | |
51 | 'registerResult', 'removeResult', 'removeHandler']\r | |
52 | \r | |
53 | # Expose obsolete functions for backwards compatibility\r | |
54 | __all__.extend(['getTestCaseNames', 'makeSuite', 'findTestCases'])\r | |
55 | \r | |
56 | __unittest = True\r | |
57 | \r | |
58 | from .result import TestResult\r | |
59 | from .case import (TestCase, FunctionTestCase, SkipTest, skip, skipIf,\r | |
60 | skipUnless, expectedFailure)\r | |
61 | from .suite import BaseTestSuite, TestSuite\r | |
62 | from .loader import (TestLoader, defaultTestLoader, makeSuite, getTestCaseNames,\r | |
63 | findTestCases)\r | |
64 | from .main import TestProgram, main\r | |
65 | from .runner import TextTestRunner, TextTestResult\r | |
66 | from .signals import installHandler, registerResult, removeResult, removeHandler\r | |
67 | \r | |
68 | # deprecated\r | |
69 | _TextTestResult = TextTestResult\r |