Home | History | Annotate | Download | only in test

Lines Matching defs:Test

8 from test import test_support
17 class Test(object):
28 """A test case which logs its calls."""
31 super(Test.LoggingTestCase, self).__init__('test')
37 def test(self):
38 self.events.append('test')
50 eq_pairs = [(Test.Foo('test1'), Test.Foo('test1'))]
53 ne_pairs = [(Test.Foo('test1'), Test.Foo('runTest'))
54 ,(Test.Foo('test1'), Test.Bar('test1'))
55 ,(Test.Foo('test1'), Test.Bar('test2'))]
63 # "Each instance of TestCase will run a single test method: the
71 class Test(unittest.TestCase):
73 def test(self): pass
75 self.assertEqual(Test().id()[-13:], '.Test.runTest')
79 # "Each instance of TestCase will run a single test method: the
82 class Test(unittest.TestCase):
84 def test(self): pass
86 self.assertEqual(Test('test').id()[-10:], '.Test.test')
90 # "Each instance of TestCase will run a single test method: the
93 class Test(unittest.TestCase):
95 def test(self): pass
98 Test('testfoo')
104 # "Return the number of tests represented by the this test object. For
108 def test(self): pass
110 self.assertEqual(Foo('test').countTestCases(), 1)
112 # "Return the default type of test result object to be used to run this
113 # test. For TestCase instances, this will always be
124 # "When a setUp() method is defined, the test runner will run that method
125 # prior to each test. Likewise, if a tearDown() method is defined, the
126 # test runner will invoke that method after each test. In the example,
127 # setUp() was used to create a fresh sequence for each test."
135 class Foo(Test.LoggingTestCase):
148 class Foo(Test.LoggingTestCase):
161 # "When a setUp() method is defined, the test runner will run that method
162 # prior to each test. Likewise, if a tearDown() method is defined, the
163 # test runner will invoke that method after each test. In the example,
164 # setUp() was used to create a fresh sequence for each test."
166 # Make sure the proper call order is maintained, even if the test raises
172 class Foo(Test.LoggingTestCase):
173 def test(self):
174 super(Foo, self).test()
175 raise RuntimeError('raised by Foo.test')
177 expected = ['startTest', 'setUp', 'test', 'addError', 'tearDown',
182 # "With a default result, an error in the test still results in stopTestRun
187 class Foo(Test.LoggingTestCase):
191 def test(self):
192 super(Foo, self).test()
193 raise RuntimeError('raised by Foo.test')
195 expected = ['startTestRun', 'startTest', 'setUp', 'test', 'addError',
200 # "When a setUp() method is defined, the test runner will run that method
201 # prior to each test. Likewise, if a tearDown() method is defined, the
202 # test runner will invoke that method after each test. In the example,
203 # setUp() was used to create a fresh sequence for each test."
205 # Make sure the proper call order is maintained, even if the test signals
211 class Foo(Test.LoggingTestCase):
212 def test(self):
213 super(Foo, self).test()
214 self.fail('raised by Foo.test')
216 expected = ['startTest', 'setUp', 'test', 'addFailure', 'tearDown',
221 # "When a test fails with a default result stopTestRun is still called."
224 class Foo(Test.LoggingTestCase):
227 def test(self):
228 super(Foo, self).test()
229 self.fail('raised by Foo.test')
231 expected = ['startTestRun', 'startTest', 'setUp', 'test', 'addFailure',
237 # "When a setUp() method is defined, the test runner will run that method
238 # prior to each test. Likewise, if a tearDown() method is defined, the
239 # test runner will invoke that method after each test. In the example,
240 # setUp() was used to create a fresh sequence for each test."
248 class Foo(Test.LoggingTestCase):
254 expected = ['startTest', 'setUp', 'test', 'tearDown', 'addError',
261 class Foo(Test.LoggingTestCase):
270 expected = ['startTestRun', 'startTest', 'setUp', 'test', 'tearDown',
281 def test(self):
284 Foo('test').run()
286 # "This class attribute gives the exception raised by the test() method.
287 # If a test framework needs to use a specialized exception, possibly to
293 def test(self):
296 self.assertTrue(Foo('test').failureException is AssertionError)
298 # "This class attribute gives the exception raised by the test() method.
299 # If a test framework needs to use a specialized exception, possibly to
309 def test(self):
314 self.assertTrue(Foo('test').failureException is RuntimeError)
317 Foo('test').run(result)
321 # "This class attribute gives the exception raised by the test() method.
322 # If a test framework needs to use a specialized exception, possibly to
332 def test(self):
337 self.assertTrue(Foo('test').failureException is RuntimeError)
340 Foo('test').run(result)
362 # "Return a string identifying the specific test case."
365 # test down too much. Really all that can be asserted is that the id()
383 def test(self):
384 events.append('test')
390 Foo('test').run()
392 expected = ['startTestRun', 'startTest', 'test', 'addSuccess',
513 # This mess of try excepts is to test the assertEqual behavior
648 test = unittest.TestCase('assertEqual')
651 test._truncateMessage = truncate
653 test.assertDictEqual({}, {1: 0})
660 test = unittest.TestCase('assertEqual')
663 test._truncateMessage = truncate
665 test.assertMultiLineEqual('foo', 'bar')
724 # Test that sequences of unhashable objects can be tested for sameness:
726 # Test that iterator of unhashable objects can be tested for sameness:
756 # test utility functions supporting assertItemsEqual()
898 test case
899 A test case is the smallest unit of testing. [...]
903 test case
904 A test case is the smallest unit of testing. [...] You may provide your
912 test case
913 - A test case is the smallest unit of testing. [...]
914 + A test case is the smallest unit of testing. [...] You may provide your
1018 """Test undocumented method name synonyms.
1022 This test confirms their continued existence and functionality
1032 """Test fail* methods pending deprecation, they will warn in 3.2.
1051 test = TestableTest('testNothing')
1054 deepcopy(test)
1111 # Can't use TestCase classes defined in Test class as
1113 test = unittest.TestCase('run')
1117 pickled_test = pickle.dumps(test, protocol=protocol)
1120 self.assertEqual(test, unpickled_test)