Home | History | Annotate | Download | only in test

Lines Matching defs:Test

9 # test isolation and reproducibility.
39 # "Return a suite of all test cases contained in the TestCase-derived
52 # "Return a suite of all test cases contained in the TestCase-derived
65 # "Return a suite of all test cases contained in the TestCase-derived
73 # test for it.
86 # "Return a suite of all test cases contained in the TestCase-derived
89 # Make sure loadTestsFromTestCase() picks up the default test method
98 # This has to be false for the test to succeed
115 def test(self):
123 expected = [loader.suiteClass([MyTestCase('test')])]
161 # XXX Certain people are using this behaviour. We'll add a test for it
164 def test(self):
173 reference = [unittest.TestSuite([MyTestCase('test')])]
183 def test(self):
210 def test(self):
239 def test(self):
267 def test(self):
296 def test(self):
322 def test(self):
356 test = list(suite)[0]
358 self.assertRaisesRegex(TypeError, "some failure", test.m)
367 # a module, a test case class, a TestSuite instance, a test method
368 # within a test case class, or a callable object which returns a
383 # a module, a test case class, a TestSuite instance, a test method
384 # within a test case class, or a callable object which returns a
392 error, test = self.check_deferred_error(loader, suite)
393 expected = "Failed to import test module: abc () //"
394 expected_regex = r"Failed to import test module: abc \(\) //"
399 ImportError, expected_regex, getattr(test, 'abc () //'))
410 error, test = self.check_deferred_error(loader, suite)
414 self.assertRaisesRegex(ImportError, expected, test.sdasfasfasdf)
417 # a module, a test case class, a TestSuite instance, a test method
418 # within a test case class, or a callable object which returns a
427 error, test = self.check_deferred_error(loader, suite)
431 self.assertRaisesRegex(AttributeError, expected, test.sdasfasfasdf)
434 # a module, a test case class, a TestSuite instance, a test method
435 # within a test case class, or a callable object which returns a
444 error, test = self.check_deferred_error(loader, suite)
448 self.assertRaisesRegex(ImportError, expected, test.sdasfasfasdf)
451 # a module, a test case class, a TestSuite instance, a test method
452 # within a test case class, or a callable object which returns a
462 error, test = self.check_deferred_error(loader, suite)
466 self.assertRaisesRegex(AttributeError, expected, test.sdasfasfasdf)
469 # a module, a test case class, a TestSuite instance, a test method
470 # within a test case class, or a callable object which returns a
483 error, test = self.check_deferred_error(loader, suite)
488 self.assertRaisesRegex(AttributeError, expected, getattr(test, ''))
491 # a module, a test case class, a TestSuite instance, a test method
492 # within a test case class, or a callable object which returns a
504 error, test = self.check_deferred_error(loader, suite)
511 AttributeError, expected_regex, getattr(test, 'abc () //'))
524 def test(self):
533 reference = [MyTestCase('test')]
537 # a module, a test case class, a TestSuite instance, a test method
538 # within a test case class, or a callable object which returns a
556 # resolve either to ... a test case class"
560 def test(self):
567 self.assertEqual(list(suite), [MyTestCase('test')])
570 # a module, a test case class, a TestSuite instance, a test method
571 # within a test case class, or a callable object which returns a
576 def test(self):
578 m.testsuite = unittest.TestSuite([MyTestCase('test')])
584 self.assertEqual(list(suite), [MyTestCase('test')])
587 # ... a test method within a test case class"
591 def test(self):
596 suite = loader.loadTestsFromName('testcase_1.test', m)
599 self.assertEqual(list(suite), [MyTestCase('test')])
602 # a module, a test case class, a TestSuite instance, a test method
603 # within a test case class, or a callable object which returns a
607 # resolve "a test method within a test case class" that doesn't exist
612 def test(self):
619 error, test = self.check_deferred_error(loader, suite)
623 self.assertRaisesRegex(AttributeError, expected, test.testfoo)
675 # ... a test method within a test case class"
684 def test(self):
690 suite = loader.loadTestsFromName('testcase_1.test', m)
693 self.assertEqual(list(suite), [MyTestCase('test')])
719 module_name = 'unittest.test.dummy'
746 :return: The first error message from the loader and the test object
755 test = list(suite)[0]
756 return error, test
785 # a module, a test case class, a TestSuite instance, a test method
786 # within a test case class, or a callable object which returns a
801 # a module, a test case class, a TestSuite instance, a test method
802 # within a test case class, or a callable object which returns a
811 error, test = self.check_deferred_error(loader, list(suite)[0])
812 test module: abc () //"
813 expected_regex = r"Failed to import test module: abc \(\) //"
818 ImportError, expected_regex, getattr(test, 'abc () //'))
821 # a module, a test case class, a TestSuite instance, a test method
822 # within a test case class, or a callable object which returns a
830 error, test = self.check_deferred_error(loader, list(suite)[0])
831 expected = "Failed to import test module: sdasfasfasdf"
835 self.assertRaisesRegex(ImportError, expected, test.sdasfasfasdf)
838 # a module, a test case class, a TestSuite instance, a test method
839 # within a test case class, or a callable object which returns a
847 ['unittest.loader.sdasfasfasdf', 'unittest.test.dummy'])
848 error, test = self.check_deferred_error(loader, list(suite)[0])
853 self.assertRaisesRegex(AttributeError, expected, test.sdasfasfasdf)
856 # a module, a test case class, a TestSuite instance, a test method
857 # within a test case class, or a callable object which returns a
868 error, test = self.check_deferred_error(loader, list(suite)[0])
873 self.assertRaisesRegex(AttributeError, expected, test.sdasfasfasdf)
876 # a module, a test case class, a TestSuite instance, a test method
877 # within a test case class, or a callable object which returns a
888 error, test = self.check_deferred_error(loader, list(suite)[1])
893 self.assertRaisesRegex(AttributeError, expected, test.sdasfasfasdf)
896 # a module, a test case class, a TestSuite instance, a test method
897 # within a test case class, or a callable object which returns a
910 error, test = self.check_deferred_error(loader, list(suite)[0])
915 self.assertRaisesRegex(AttributeError, expected, getattr(test, ''))
918 # a module, a test case class, a TestSuite instance, a test method
919 # within a test case class, or a callable object which returns a
930 error, test = self.check_deferred_error(loader, list(suite)[0])
937 AttributeError, expected_regex, getattr(test, 'abc () //'))
948 def test(self):
957 reference = [unittest.TestSuite([MyTestCase('test')])]
961 # a module, a test case class, a TestSuite instance, a test method
962 # within a test case class, or a callable object which returns a
980 # ... a test case class"
984 def test(self):
992 expected = loader.suiteClass([MyTestCase('test')])
1000 def test(self):
1002 m.testsuite = unittest.TestSuite([MyTestCase('test')])
1011 # test method within a test case class"
1015 def test(self):
1020 suite = loader.loadTestsFromNames(['testcase_1.test'], m)
1023 ref_suite = unittest.TestSuite([MyTestCase('test')])
1032 test = lambda: 1
1036 suite = loader.loadTestsFromNames(['testcase_1.test'], m)
1039 ref_suite = unittest.TestSuite([MyTestCase('test')])
1043 # test method within a test case class"
1046 # resolve to "a test method within a test case class" but don't?
1050 def test(self):
1056 error, test = self.check_deferred_error(loader, list(suite)[0])
1061 self.assertRaisesRegex(AttributeError, expected, test.testfoo)
1103 def test(self):
1106 testcase_1 = Test1('test')
1144 module_name = 'unittest.test.dummy'
1168 # Test.foobar is defined to make sure getTestCaseNames() respects
1171 class Test(unittest.TestCase):
1178 self.assertEqual(loader.getTestCaseNames(Test), ['test_1', 'test_2'])
1184 class Test(unittest.TestCase):
1189 self.assertEqual(loader.getTestCaseNames(Test), [])
1263 # touch a TestCase's attribute if it starts with the test method prefix.
1267 self.fail('Non-test attribute accessed')
1287 # test methods"
1304 loader.testMethodPrefix = 'test'
1308 # test methods"
1327 loader.testMethodPrefix = 'test'
1331 # test methods"
1350 loader.testMethodPrefix = 'test'
1354 # test methods"
1374 loader.testMethodPrefix = 'test'
1377 # "The default value is 'test'"
1380 self.assertEqual(loader.testMethodPrefix, 'test')
1512 # "Callable object that constructs a test suite from a list of tests."