Back to index

python3.2  3.2.2
Public Member Functions
unittest.test.test_functiontestcase.Test_FunctionTestCase Class Reference

List of all members.

Public Member Functions

def test_countTestCases
def test_run_call_order__error_in_setUp
def test_run_call_order__error_in_test
def test_run_call_order__failure_in_test
def test_run_call_order__error_in_tearDown
def test_id
def test_shortDescription__no_docstring
def test_shortDescription__singleline_docstring

Detailed Description

Definition at line 6 of file test_functiontestcase.py.


Member Function Documentation

Definition at line 10 of file test_functiontestcase.py.

00010 
00011     def test_countTestCases(self):
00012         test = unittest.FunctionTestCase(lambda: None)
00013 
00014         self.assertEqual(test.countTestCases(), 1)

Here is the call graph for this function:

Definition at line 124 of file test_functiontestcase.py.

00124 
00125     def test_id(self):
00126         test = unittest.FunctionTestCase(lambda: None)
00127 
00128         self.assertIsInstance(test.id(), str)

Here is the call graph for this function:

Definition at line 22 of file test_functiontestcase.py.

00022 
00023     def test_run_call_order__error_in_setUp(self):
00024         events = []
00025         result = LoggingResult(events)
00026 
00027         def setUp():
00028             events.append('setUp')
00029             raise RuntimeError('raised by setUp')
00030 
00031         def test():
00032             events.append('test')
00033 
00034         def tearDown():
00035             events.append('tearDown')
00036 
00037         expected = ['startTest', 'setUp', 'addError', 'stopTest']
00038         unittest.FunctionTestCase(test, setUp, tearDown).run(result)
00039         self.assertEqual(events, expected)

Here is the call graph for this function:

Definition at line 99 of file test_functiontestcase.py.

00099 
00100     def test_run_call_order__error_in_tearDown(self):
00101         events = []
00102         result = LoggingResult(events)
00103 
00104         def setUp():
00105             events.append('setUp')
00106 
00107         def test():
00108             events.append('test')
00109 
00110         def tearDown():
00111             events.append('tearDown')
00112             raise RuntimeError('raised by tearDown')
00113 
00114         expected = ['startTest', 'setUp', 'test', 'tearDown', 'addError',
00115                     'stopTest']
00116         unittest.FunctionTestCase(test, setUp, tearDown).run(result)
00117         self.assertEqual(events, expected)

Here is the call graph for this function:

Definition at line 47 of file test_functiontestcase.py.

00047 
00048     def test_run_call_order__error_in_test(self):
00049         events = []
00050         result = LoggingResult(events)
00051 
00052         def setUp():
00053             events.append('setUp')
00054 
00055         def test():
00056             events.append('test')
00057             raise RuntimeError('raised by test')
00058 
00059         def tearDown():
00060             events.append('tearDown')
00061 
00062         expected = ['startTest', 'setUp', 'test', 'tearDown',
00063                     'addError', 'stopTest']
00064         unittest.FunctionTestCase(test, setUp, tearDown).run(result)
00065         self.assertEqual(events, expected)

Here is the call graph for this function:

Definition at line 73 of file test_functiontestcase.py.

00073 
00074     def test_run_call_order__failure_in_test(self):
00075         events = []
00076         result = LoggingResult(events)
00077 
00078         def setUp():
00079             events.append('setUp')
00080 
00081         def test():
00082             events.append('test')
00083             self.fail('raised by test')
00084 
00085         def tearDown():
00086             events.append('tearDown')
00087 
00088         expected = ['startTest', 'setUp', 'test', 'tearDown',
00089                     'addFailure', 'stopTest']
00090         unittest.FunctionTestCase(test, setUp, tearDown).run(result)
00091         self.assertEqual(events, expected)

Here is the call graph for this function:

Definition at line 132 of file test_functiontestcase.py.

00132 
00133     def test_shortDescription__no_docstring(self):
00134         test = unittest.FunctionTestCase(lambda: None)
00135 
00136         self.assertEqual(test.shortDescription(), None)

Here is the call graph for this function:

Definition at line 140 of file test_functiontestcase.py.

00140 
00141     def test_shortDescription__singleline_docstring(self):
00142         desc = "this tests foo"
00143         test = unittest.FunctionTestCase(lambda: None, description=desc)
00144 
00145         self.assertEqual(test.shortDescription(), "this tests foo")

Here is the call graph for this function:


The documentation for this class was generated from the following file: