]> granicus.if.org Git - python/commitdiff
Merged revisions 73718,73721,73723 via svnmerge from
authorGeorg Brandl <georg@python.org>
Thu, 13 Aug 2009 08:52:53 +0000 (08:52 +0000)
committerGeorg Brandl <georg@python.org>
Thu, 13 Aug 2009 08:52:53 +0000 (08:52 +0000)
svn+ssh://svn.python.org/python/branches/py3k

................
  r73718 | benjamin.peterson | 2009-07-01 01:35:19 +0200 (Mi, 01 Jul 2009) | 9 lines

  Merged revisions 73717 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r73717 | benjamin.peterson | 2009-06-30 18:30:12 -0500 (Tue, 30 Jun 2009) | 1 line

    use assert* methods in test_unittest
  ........
................
  r73721 | benjamin.peterson | 2009-07-01 02:43:10 +0200 (Mi, 01 Jul 2009) | 11 lines

  Merged revisions 73720 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r73720 | benjamin.peterson | 2009-06-30 19:36:41 -0500 (Tue, 30 Jun 2009) | 4 lines

    fix a few cases where automated fail -> assert translation messed up

    Thanks Joe Amenta
  ........
................
  r73723 | benjamin.peterson | 2009-07-01 02:45:43 +0200 (Mi, 01 Jul 2009) | 1 line

  remove use of failIf
................

Lib/ctypes/test/test_internals.py
Lib/test/support.py
Lib/test/test_logging.py
Lib/test/test_unittest.py

index f7d9a1b2086805008cec8b6202dcc10cc0e19dd0..03d820ec7ec6f77a856841d7fb7b4d4d9af25abe 100644 (file)
@@ -18,7 +18,7 @@ What about pointers?
 """
 
 class ObjectsTestCase(unittest.TestCase):
-    def assertTrueSame(self, a, b):
+    def assertSame(self, a, b):
         self.assertEqual(id(a), id(b))
 
     def test_ints(self):
@@ -33,7 +33,7 @@ class ObjectsTestCase(unittest.TestCase):
         rc = grc(s)
         cs = c_char_p(s)
         self.assertEqual(rc + 1, grc(s))
-        self.assertTrueSame(cs._objects, s)
+        self.assertSame(cs._objects, s)
 
     def test_simple_struct(self):
         class X(Structure):
index 337a33fcfaf1e8a3a09b90166b54726e9b765918..f916f4abec8ef586cae013bb3a6e0697dc77badb 100644 (file)
@@ -731,7 +731,7 @@ def bigmemtest(minsize, memuse, overhead=5*_1M):
                 # to make sure they work. We still want to avoid using
                 # too much memory, though, but we do that noisily.
                 maxsize = 5147
-                self.failIf(maxsize * memuse + overhead > 20 * _1M)
+                self.assertFalse(maxsize * memuse + overhead > 20 * _1M)
             else:
                 maxsize = int((max_memuse - overhead) / memuse)
                 if maxsize < minsize:
index 72b26bb64a798f9ef03134a2388b10656c9a9b15..aff0ce3a6789140dfb35dff03294755de08f32d7 100644 (file)
@@ -99,7 +99,7 @@ class BaseTest(unittest.TestCase):
         finally:
             logging._releaseLock()
 
-    def assertTruelog_lines(self, expected_values, stream=None):
+    def assert_log_lines(self, expected_values, stream=None):
         """Match the collected log lines against the regular expression
         self.expected_log_pat, and compare the extracted group values to
         the expected_values list of tuples."""
@@ -165,7 +165,7 @@ class BuiltinLevelsTest(BaseTest):
 
         INF.debug(m())
 
-        self.assertTruelog_lines([
+        self.assert_log_lines([
             ('ERR', 'CRITICAL', '1'),
             ('ERR', 'ERROR', '2'),
             ('INF', 'CRITICAL', '3'),
@@ -197,7 +197,7 @@ class BuiltinLevelsTest(BaseTest):
         INF_ERR.info(m())
         INF_ERR.debug(m())
 
-        self.assertTruelog_lines([
+        self.assert_log_lines([
             ('INF.ERR', 'CRITICAL', '1'),
             ('INF.ERR', 'ERROR', '2'),
         ])
@@ -228,7 +228,7 @@ class BuiltinLevelsTest(BaseTest):
         INF_ERR_UNDEF.info(m())
         INF_ERR_UNDEF.debug(m())
 
-        self.assertTruelog_lines([
+        self.assert_log_lines([
             ('INF.UNDEF', 'CRITICAL', '1'),
             ('INF.UNDEF', 'ERROR', '2'),
             ('INF.UNDEF', 'WARNING', '3'),
@@ -256,7 +256,7 @@ class BuiltinLevelsTest(BaseTest):
         GRANDCHILD.debug(m())
         CHILD.debug(m())
 
-        self.assertTruelog_lines([
+        self.assert_log_lines([
             ('INF.BADPARENT.UNDEF', 'CRITICAL', '1'),
             ('INF.BADPARENT.UNDEF', 'INFO', '2'),
             ('INF.BADPARENT', 'CRITICAL', '3'),
@@ -285,7 +285,7 @@ class BasicFilterTest(BaseTest):
             spam_eggs_fish.info(self.next_message())  # Good.
             spam_bakedbeans.info(self.next_message())
 
-            self.assertTruelog_lines([
+            self.assert_log_lines([
                 ('spam.eggs', 'INFO', '2'),
                 ('spam.eggs.fish', 'INFO', '3'),
             ])
@@ -367,7 +367,7 @@ class CustomLevelsAndFiltersTest(BaseTest):
         self.root_logger.setLevel(VERBOSE)
         # Levels >= 'Verbose' are good.
         self.log_at_all_levels(self.root_logger)
-        self.assertTruelog_lines([
+        self.assert_log_lines([
             ('Verbose', '5'),
             ('Sociable', '6'),
             ('Effusive', '7'),
@@ -382,7 +382,7 @@ class CustomLevelsAndFiltersTest(BaseTest):
         try:
             # Levels >= 'Sociable' are good.
             self.log_at_all_levels(self.root_logger)
-            self.assertTruelog_lines([
+            self.assert_log_lines([
                 ('Sociable', '6'),
                 ('Effusive', '7'),
                 ('Terse', '8'),
@@ -413,12 +413,12 @@ class CustomLevelsAndFiltersTest(BaseTest):
                 ('Taciturn', '9'),
                 ('Silent', '10'),
             ]
-            self.assertTruelog_lines(first_lines)
+            self.assert_log_lines(first_lines)
 
             specific_filter = VerySpecificFilter()
             self.root_logger.addFilter(specific_filter)
             self.log_at_all_levels(self.root_logger)
-            self.assertTruelog_lines(first_lines + [
+            self.assert_log_lines(first_lines + [
                 # Not only 'Garrulous' is still missing, but also 'Sociable'
                 # and 'Taciturn'
                 ('Boring', '11'),
@@ -458,9 +458,9 @@ class MemoryHandlerTest(BaseTest):
         # The memory handler flushes to its target handler based on specific
         #  criteria (message count and message level).
         self.mem_logger.debug(self.next_message())
-        self.assertTruelog_lines([])
+        self.assert_log_lines([])
         self.mem_logger.info(self.next_message())
-        self.assertTruelog_lines([])
+        self.assert_log_lines([])
         # This will flush because the level is >= logging.WARNING
         self.mem_logger.warn(self.next_message())
         lines = [
@@ -468,19 +468,19 @@ class MemoryHandlerTest(BaseTest):
             ('INFO', '2'),
             ('WARNING', '3'),
         ]
-        self.assertTruelog_lines(lines)
+        self.assert_log_lines(lines)
         for n in (4, 14):
             for i in range(9):
                 self.mem_logger.debug(self.next_message())
-            self.assertTruelog_lines(lines)
+            self.assert_log_lines(lines)
             # This will flush because it's the 10th message since the last
             #  flush.
             self.mem_logger.debug(self.next_message())
             lines = lines + [('DEBUG', str(i)) for i in range(n, n + 10)]
-            self.assertTruelog_lines(lines)
+            self.assert_log_lines(lines)
 
         self.mem_logger.debug(self.next_message())
-        self.assertTruelog_lines(lines)
+        self.assert_log_lines(lines)
 
 
 class ExceptionFormatter(logging.Formatter):
@@ -650,11 +650,11 @@ class ConfigFileTest(BaseTest):
             logger.info(self.next_message())
             # Outputs a message
             logger.error(self.next_message())
-            self.assertTruelog_lines([
+            self.assert_log_lines([
                 ('ERROR', '2'),
             ], stream=output)
             # Original logger output is empty.
-            self.assertTruelog_lines([])
+            self.assert_log_lines([])
 
     def test_config1_ok(self, config=config1):
         # A config file defining a sub-parser as well.
@@ -664,12 +664,12 @@ class ConfigFileTest(BaseTest):
             # Both will output a message
             logger.info(self.next_message())
             logger.error(self.next_message())
-            self.assertTruelog_lines([
+            self.assert_log_lines([
                 ('INFO', '1'),
                 ('ERROR', '2'),
             ], stream=output)
             # Original logger output is empty.
-            self.assertTruelog_lines([])
+            self.assert_log_lines([])
 
     def test_config2_failure(self):
         # A simple config file which overrides the default settings.
@@ -692,7 +692,7 @@ class ConfigFileTest(BaseTest):
             self.assertEquals(output.getvalue(),
                 "ERROR:root:just testing\nGot a [RuntimeError]\n")
             # Original logger output is empty
-            self.assertTruelog_lines([])
+            self.assert_log_lines([])
 
     def test_config5_ok(self):
         self.test_config1_ok(config=self.config5)
@@ -847,7 +847,7 @@ class MemoryTest(BaseTest):
         foo.setLevel(logging.DEBUG)
         self.root_logger.debug(self.next_message())
         foo.debug(self.next_message())
-        self.assertTruelog_lines([
+        self.assert_log_lines([
             ('foo', 'DEBUG', '2'),
         ])
         del foo
@@ -856,7 +856,7 @@ class MemoryTest(BaseTest):
         # foo has retained its settings.
         bar = logging.getLogger("foo")
         bar.debug(self.next_message())
-        self.assertTruelog_lines([
+        self.assert_log_lines([
             ('foo', 'DEBUG', '2'),
             ('foo', 'DEBUG', '3'),
         ])
index 858f24b7d48a6968cfacf70f5f72b0c2ac115fdc..d59bf8a3aec767d9ac59367bc3d0d8303e927534 100644 (file)
@@ -75,8 +75,8 @@ class TestEquality(object):
     # Check for a valid __ne__ implementation
     def test_ne(self):
         for obj_1, obj_2 in self.ne_pairs:
-            self.failIfEqual(obj_1, obj_2)
-            self.failIfEqual(obj_2, obj_1)
+            self.assertNotEqual(obj_1, obj_2)
+            self.assertNotEqual(obj_2, obj_1)
 
 class TestHashing(object):
     """Used as a mixin for TestCase"""
@@ -178,10 +178,10 @@ class Test_TestLoader(TestCase):
 
         loader = unittest.TestLoader()
         # This has to be false for the test to succeed
-        self.failIf('runTest'.startswith(loader.testMethodPrefix))
+        self.assertFalse('runTest'.startswith(loader.testMethodPrefix))
 
         suite = loader.loadTestsFromTestCase(Foo)
-        self.failUnless(isinstance(suite, loader.suiteClass))
+        self.assertTrue(isinstance(suite, loader.suiteClass))
         self.assertEqual(list(suite), [Foo('runTest')])
 
     ################################################################
@@ -200,7 +200,7 @@ class Test_TestLoader(TestCase):
 
         loader = unittest.TestLoader()
         suite = loader.loadTestsFromModule(m)
-        self.failUnless(isinstance(suite, loader.suiteClass))
+        self.assertTrue(isinstance(suite, loader.suiteClass))
 
         expected = [loader.suiteClass([MyTestCase('test')])]
         self.assertEqual(list(suite), expected)
@@ -213,7 +213,7 @@ class Test_TestLoader(TestCase):
 
         loader = unittest.TestLoader()
         suite = loader.loadTestsFromModule(m)
-        self.failUnless(isinstance(suite, loader.suiteClass))
+        self.assertTrue(isinstance(suite, loader.suiteClass))
         self.assertEqual(list(suite), [])
 
     # "This method searches `module` for classes derived from TestCase"
@@ -227,7 +227,7 @@ class Test_TestLoader(TestCase):
 
         loader = unittest.TestLoader()
         suite = loader.loadTestsFromModule(m)
-        self.failUnless(isinstance(suite, loader.suiteClass))
+        self.assertTrue(isinstance(suite, loader.suiteClass))
 
         self.assertEqual(list(suite), [loader.suiteClass()])
 
@@ -439,7 +439,7 @@ class Test_TestLoader(TestCase):
 
         loader = unittest.TestLoader()
         suite = loader.loadTestsFromName('testcase_1', m)
-        self.failUnless(isinstance(suite, loader.suiteClass))
+        self.assertTrue(isinstance(suite, loader.suiteClass))
         self.assertEqual(list(suite), [MyTestCase('test')])
 
     # "The specifier name is a ``dotted name'' that may resolve either to
@@ -455,7 +455,7 @@ class Test_TestLoader(TestCase):
 
         loader = unittest.TestLoader()
         suite = loader.loadTestsFromName('testsuite', m)
-        self.failUnless(isinstance(suite, loader.suiteClass))
+        self.assertTrue(isinstance(suite, loader.suiteClass))
 
         self.assertEqual(list(suite), [MyTestCase('test')])
 
@@ -470,7 +470,7 @@ class Test_TestLoader(TestCase):
 
         loader = unittest.TestLoader()
         suite = loader.loadTestsFromName('testcase_1.test', m)
-        self.failUnless(isinstance(suite, loader.suiteClass))
+        self.assertTrue(isinstance(suite, loader.suiteClass))
 
         self.assertEqual(list(suite), [MyTestCase('test')])
 
@@ -509,7 +509,7 @@ class Test_TestLoader(TestCase):
 
         loader = unittest.TestLoader()
         suite = loader.loadTestsFromName('return_TestSuite', m)
-        self.failUnless(isinstance(suite, loader.suiteClass))
+        self.assertTrue(isinstance(suite, loader.suiteClass))
         self.assertEqual(list(suite), [testcase_1, testcase_2])
 
     # "The specifier name is a ``dotted name'' that may resolve ... to
@@ -523,7 +523,7 @@ class Test_TestLoader(TestCase):
 
         loader = unittest.TestLoader()
         suite = loader.loadTestsFromName('return_TestCase', m)
-        self.failUnless(isinstance(suite, loader.suiteClass))
+        self.assertTrue(isinstance(suite, loader.suiteClass))
         self.assertEqual(list(suite), [testcase_1])
 
     # "The specifier name is a ``dotted name'' that may resolve ... to
@@ -562,11 +562,11 @@ class Test_TestLoader(TestCase):
         try:
             suite = loader.loadTestsFromName(module_name)
 
-            self.failUnless(isinstance(suite, loader.suiteClass))
+            self.assertTrue(isinstance(suite, loader.suiteClass))
             self.assertEqual(list(suite), [])
 
             # audioop should now be loaded, thanks to loadTestsFromName()
-            self.failUnless(module_name in sys.modules)
+            self.assertTrue(module_name in sys.modules)
         finally:
             if module_name in sys.modules:
                 del sys.modules[module_name]
@@ -585,7 +585,7 @@ class Test_TestLoader(TestCase):
         loader = unittest.TestLoader()
 
         suite = loader.loadTestsFromNames([])
-        self.failUnless(isinstance(suite, loader.suiteClass))
+        self.assertTrue(isinstance(suite, loader.suiteClass))
         self.assertEqual(list(suite), [])
 
     # "Similar to loadTestsFromName(), but takes a sequence of names rather
@@ -600,7 +600,7 @@ class Test_TestLoader(TestCase):
         loader = unittest.TestLoader()
 
         suite = loader.loadTestsFromNames([], unittest)
-        self.failUnless(isinstance(suite, loader.suiteClass))
+        self.assertTrue(isinstance(suite, loader.suiteClass))
         self.assertEqual(list(suite), [])
 
     # "The specifier name is a ``dotted name'' that may resolve either to
@@ -801,7 +801,7 @@ class Test_TestLoader(TestCase):
 
         loader = unittest.TestLoader()
         suite = loader.loadTestsFromNames(['testcase_1'], m)
-        self.failUnless(isinstance(suite, loader.suiteClass))
+        self.assertTrue(isinstance(suite, loader.suiteClass))
 
         expected = loader.suiteClass([MyTestCase('test')])
         self.assertEqual(list(suite), [expected])
@@ -817,7 +817,7 @@ class Test_TestLoader(TestCase):
 
         loader = unittest.TestLoader()
         suite = loader.loadTestsFromNames(['testsuite'], m)
-        self.failUnless(isinstance(suite, loader.suiteClass))
+        self.assertTrue(isinstance(suite, loader.suiteClass))
 
         self.assertEqual(list(suite), [m.testsuite])
 
@@ -832,7 +832,7 @@ class Test_TestLoader(TestCase):
 
         loader = unittest.TestLoader()
         suite = loader.loadTestsFromNames(['testcase_1.test'], m)
-        self.failUnless(isinstance(suite, loader.suiteClass))
+        self.assertTrue(isinstance(suite, loader.suiteClass))
 
         ref_suite = unittest.TestSuite([MyTestCase('test')])
         self.assertEqual(list(suite), [ref_suite])
@@ -869,7 +869,7 @@ class Test_TestLoader(TestCase):
 
         loader = unittest.TestLoader()
         suite = loader.loadTestsFromNames(['return_TestSuite'], m)
-        self.failUnless(isinstance(suite, loader.suiteClass))
+        self.assertTrue(isinstance(suite, loader.suiteClass))
 
         expected = unittest.TestSuite([testcase_1, testcase_2])
         self.assertEqual(list(suite), [expected])
@@ -885,7 +885,7 @@ class Test_TestLoader(TestCase):
 
         loader = unittest.TestLoader()
         suite = loader.loadTestsFromNames(['return_TestCase'], m)
-        self.failUnless(isinstance(suite, loader.suiteClass))
+        self.assertTrue(isinstance(suite, loader.suiteClass))
 
         ref_suite = unittest.TestSuite([testcase_1])
         self.assertEqual(list(suite), [ref_suite])
@@ -909,7 +909,7 @@ class Test_TestLoader(TestCase):
 
         loader = unittest.TestLoader()
         suite = loader.loadTestsFromNames(['Foo.foo'], m)
-        self.failUnless(isinstance(suite, loader.suiteClass))
+        self.assertTrue(isinstance(suite, loader.suiteClass))
 
         ref_suite = unittest.TestSuite([testcase_1])
         self.assertEqual(list(suite), [ref_suite])
@@ -950,11 +950,11 @@ class Test_TestLoader(TestCase):
         try:
             suite = loader.loadTestsFromNames([module_name])
 
-            self.failUnless(isinstance(suite, loader.suiteClass))
+            self.assertTrue(isinstance(suite, loader.suiteClass))
             self.assertEqual(list(suite), [unittest.TestSuite()])
 
             # audioop should now be loaded, thanks to loadTestsFromName()
-            self.failUnless(module_name in sys.modules)
+            self.assertTrue(module_name in sys.modules)
         finally:
             if module_name in sys.modules:
                 del sys.modules[module_name]
@@ -1325,7 +1325,7 @@ class Test_TestLoader(TestCase):
     # "The default value is the TestSuite class"
     def test_suiteClass__default_value(self):
         loader = unittest.TestLoader()
-        self.failUnless(loader.suiteClass is unittest.TestSuite)
+        self.assertTrue(loader.suiteClass is unittest.TestSuite)
 
     ################################################################
     ### /Tests for TestLoader.suiteClass
@@ -1738,7 +1738,7 @@ class Test_FunctionTestCase(TestCase):
     def test_id(self):
         test = unittest.FunctionTestCase(lambda: None)
 
-        self.failUnless(isinstance(test.id(), str))
+        self.assertTrue(isinstance(test.id(), str))
 
     # "Returns a one-line description of the test, or None if no description
     # has been provided. The default implementation of this method returns
@@ -1770,7 +1770,7 @@ class Test_TestResult(TestCase):
     def test_init(self):
         result = unittest.TestResult()
 
-        self.failUnless(result.wasSuccessful())
+        self.assertTrue(result.wasSuccessful())
         self.assertEqual(len(result.errors), 0)
         self.assertEqual(len(result.failures), 0)
         self.assertEqual(result.testsRun, 0)
@@ -1799,7 +1799,7 @@ class Test_TestResult(TestCase):
 
         result.startTest(test)
 
-        self.failUnless(result.wasSuccessful())
+        self.assertTrue(result.wasSuccessful())
         self.assertEqual(len(result.errors), 0)
         self.assertEqual(len(result.failures), 0)
         self.assertEqual(result.testsRun, 1)
@@ -1820,7 +1820,7 @@ class Test_TestResult(TestCase):
 
         result.startTest(test)
 
-        self.failUnless(result.wasSuccessful())
+        self.assertTrue(result.wasSuccessful())
         self.assertEqual(len(result.errors), 0)
         self.assertEqual(len(result.failures), 0)
         self.assertEqual(result.testsRun, 1)
@@ -1829,7 +1829,7 @@ class Test_TestResult(TestCase):
         result.stopTest(test)
 
         # Same tests as above; make sure nothing has changed
-        self.failUnless(result.wasSuccessful())
+        self.assertTrue(result.wasSuccessful())
         self.assertEqual(len(result.errors), 0)
         self.assertEqual(len(result.failures), 0)
         self.assertEqual(result.testsRun, 1)
@@ -1873,7 +1873,7 @@ class Test_TestResult(TestCase):
         result.addSuccess(test)
         result.stopTest(test)
 
-        self.failUnless(result.wasSuccessful())
+        self.assertTrue(result.wasSuccessful())
         self.assertEqual(len(result.errors), 0)
         self.assertEqual(len(result.failures), 0)
         self.assertEqual(result.testsRun, 1)
@@ -1918,15 +1918,15 @@ class Test_TestResult(TestCase):
         result.addFailure(test, exc_info_tuple)
         result.stopTest(test)
 
-        self.failIf(result.wasSuccessful())
+        self.assertFalse(result.wasSuccessful())
         self.assertEqual(len(result.errors), 0)
         self.assertEqual(len(result.failures), 1)
         self.assertEqual(result.testsRun, 1)
         self.assertEqual(result.shouldStop, False)
 
         test_case, formatted_exc = result.failures[0]
-        self.failUnless(test_case is test)
-        self.failUnless(isinstance(formatted_exc, str))
+        self.assertTrue(test_case is test)
+        self.assertTrue(isinstance(formatted_exc, str))
 
     # "addError(test, err)"
     # ...
@@ -1968,15 +1968,15 @@ class Test_TestResult(TestCase):
         result.addError(test, exc_info_tuple)
         result.stopTest(test)
 
-        self.failIf(result.wasSuccessful())
+        self.assertFalse(result.wasSuccessful())
         self.assertEqual(len(result.errors), 1)
         self.assertEqual(len(result.failures), 0)
         self.assertEqual(result.testsRun, 1)
         self.assertEqual(result.shouldStop, False)
 
         test_case, formatted_exc = result.errors[0]
-        self.failUnless(test_case is test)
-        self.failUnless(isinstance(formatted_exc, str))
+        self.assertTrue(test_case is test)
+        self.assertTrue(isinstance(formatted_exc, str))
 
 ### Support code for Test_TestCase
 ################################################################
@@ -2290,7 +2290,7 @@ class Test_TestCase(TestCase, TestEquality, TestHashing):
             def test(self):
                 pass
 
-        self.failUnless(Foo('test').failureException is AssertionError)
+        self.assertTrue(Foo('test').failureException is AssertionError)
 
     # "This class attribute gives the exception raised by the test() method.
     # If a test framework needs to use a specialized exception, possibly to
@@ -2308,7 +2308,7 @@ class Test_TestCase(TestCase, TestEquality, TestHashing):
 
             failureException = RuntimeError
 
-        self.failUnless(Foo('test').failureException is RuntimeError)
+        self.assertTrue(Foo('test').failureException is RuntimeError)
 
 
         Foo('test').run(result)
@@ -2331,7 +2331,7 @@ class Test_TestCase(TestCase, TestEquality, TestHashing):
 
             failureException = RuntimeError
 
-        self.failUnless(Foo('test').failureException is RuntimeError)
+        self.assertTrue(Foo('test').failureException is RuntimeError)
 
 
         Foo('test').run(result)
@@ -2367,7 +2367,7 @@ class Test_TestCase(TestCase, TestEquality, TestHashing):
             def runTest(self):
                 pass
 
-        self.failUnless(isinstance(Foo().id(), str))
+        self.assertTrue(isinstance(Foo().id(), str))
 
     # "If result is omitted or None, a temporary result object is created
     # and used, but is not made available to the caller. As TestCase owns the
@@ -2900,23 +2900,23 @@ class Test_TestSkipping(TestCase):
 
 class Test_Assertions(TestCase):
     def test_AlmostEqual(self):
-        self.failUnlessAlmostEqual(1.00000001, 1.0)
-        self.failIfAlmostEqual(1.0000001, 1.0)
+        self.assertAlmostEqual(1.00000001, 1.0)
+        self.assertNotAlmostEqual(1.0000001, 1.0)
         self.assertRaises(self.failureException,
-                          self.failUnlessAlmostEqual, 1.0000001, 1.0)
+                          self.assertAlmostEqual, 1.0000001, 1.0)
         self.assertRaises(self.failureException,
-                          self.failIfAlmostEqual, 1.00000001, 1.0)
+                          self.assertNotAlmostEqual, 1.00000001, 1.0)
 
-        self.failUnlessAlmostEqual(1.1, 1.0, places=0)
+        self.assertAlmostEqual(1.1, 1.0, places=0)
         self.assertRaises(self.failureException,
-                          self.failUnlessAlmostEqual, 1.1, 1.0, places=1)
+                          self.assertAlmostEqual, 1.1, 1.0, places=1)
 
-        self.failUnlessAlmostEqual(0, .1+.1j, places=0)
-        self.failIfAlmostEqual(0, .1+.1j, places=1)
+        self.assertAlmostEqual(0, .1+.1j, places=0)
+        self.assertNotAlmostEqual(0, .1+.1j, places=1)
         self.assertRaises(self.failureException,
-                          self.failUnlessAlmostEqual, 0, .1+.1j, places=1)
+                          self.assertAlmostEqual, 0, .1+.1j, places=1)
         self.assertRaises(self.failureException,
-                          self.failIfAlmostEqual, 0, .1+.1j, places=0)
+                          self.assertNotAlmostEqual, 0, .1+.1j, places=0)
 
     def test_assertRaises(self):
         def _raise(e):