diff options
| author | Gregory P. Smith <greg@mad-scientist.com> | 2009-03-31 19:03:28 (GMT) |
|---|---|---|
| committer | Gregory P. Smith <greg@mad-scientist.com> | 2009-03-31 19:03:28 (GMT) |
| commit | 7558d57ad2699bc0092954df052079e5f158d3f0 (patch) | |
| tree | 501fc6d29f2a97ef2f0160f1ac5fe9a23a35e6a7 /Lib/test/test_unittest.py | |
| parent | 6eabc24416d1ace6ea4d86793f0bc10f5e274955 (diff) | |
| download | cpython-7558d57ad2699bc0092954df052079e5f158d3f0.zip cpython-7558d57ad2699bc0092954df052079e5f158d3f0.tar.gz cpython-7558d57ad2699bc0092954df052079e5f158d3f0.tar.bz2 | |
Rename the actual method definitions to the official assertFoo names.
Adds unittests to make sure the old fail* names continue to work now
and adds a comment that they are pending deprecation.
Also adds a test to confirm that the plural Equals method variants
continue to exist even though we're unlikely to deprecate those.
http://bugs.python.org/issue2578
Diffstat (limited to 'Lib/test/test_unittest.py')
| -rw-r--r-- | Lib/test/test_unittest.py | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/Lib/test/test_unittest.py b/Lib/test/test_unittest.py index 85ebf46..25fe592 100644 --- a/Lib/test/test_unittest.py +++ b/Lib/test/test_unittest.py @@ -2283,7 +2283,6 @@ class Test_TestCase(TestCase, TestEquality, TestHashing): 'Tests shortDescription() for a method with a longer ' 'docstring.')) - def testAddTypeEqualityFunc(self): class SadSnake(object): """Dummy class for test_addTypeEqualityFunc.""" @@ -2658,6 +2657,33 @@ test case self.assertRaisesRegexp, Exception, re.compile('^Expected$'), Stub) + def testSynonymAssertMethodNames(self): + """Test undocumented method name synonyms. + + Please do not use these methods names in your own code. + + This test confirms their continued existence and functionality + in order to avoid breaking existing code. + """ + self.assertNotEquals(3, 5) + self.assertEquals(3, 3) + self.assertAlmostEquals(2.0, 2.0) + self.assertNotAlmostEquals(3.0, 5.0) + self.assert_(True) + + def testPendingDeprecationMethodNames(self): + """Test fail* methods pending deprecation, they will warn in 3.2. + + Do not use these methods. They will go away in 3.3. + """ + self.failIfEqual(3, 5) + self.failUnlessEqual(3, 3) + self.failUnlessAlmostEqual(2.0, 2.0) + self.failIfAlmostEqual(3.0, 5.0) + self.failUnless(True) + self.failUnlessRaises(TypeError, lambda _: 3.14 + u'spam') + self.failIf(False) + class Test_TestSkipping(TestCase): |
