diff options
author | Gregory P. Smith <greg@krypto.org> | 2022-01-26 20:39:15 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-26 20:39:15 -0800 |
commit | b50322d20337ca468f2070eedb051a16ee1eba94 (patch) | |
tree | ba478b8fe2b91b583cec640d518f9643fb5b6f7d /Lib/unittest/test/_test_warnings.py | |
parent | 9f0881476e0113d3a35e0ffa96649b9276dd75c5 (diff) | |
download | cpython-git-b50322d20337ca468f2070eedb051a16ee1eba94.tar.gz |
bpo-45162: Revert "Remove many old deprecated unittest features" (GH-30935)
Revert "bpo-45162: Remove many old deprecated unittest features (GH-28268)"
This reverts commit b0a6ede3d0bd6fa4ffe413ab4dfc1059201df25b.
We're deferring this change until 3.12 while upstream projects that use
the legacy assertion method names are fixed. See the issue for links
to the discussion. Many upstream projects now have issues and PRs
filed.
Diffstat (limited to 'Lib/unittest/test/_test_warnings.py')
-rw-r--r-- | Lib/unittest/test/_test_warnings.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/unittest/test/_test_warnings.py b/Lib/unittest/test/_test_warnings.py index 08b846ee47..5cbfb532ad 100644 --- a/Lib/unittest/test/_test_warnings.py +++ b/Lib/unittest/test/_test_warnings.py @@ -18,6 +18,17 @@ def warnfun(): warnings.warn('rw', RuntimeWarning) class TestWarnings(unittest.TestCase): + # unittest warnings will be printed at most once per type (max one message + # for the fail* methods, and one for the assert* methods) + def test_assert(self): + self.assertEquals(2+2, 4) + self.assertEquals(2*2, 4) + self.assertEquals(2**2, 4) + + def test_fail(self): + self.failUnless(1) + self.failUnless(True) + def test_other_unittest(self): self.assertAlmostEqual(2+2, 4) self.assertNotAlmostEqual(4+4, 2) |