Commit 6bcbad5f authored by Benjamin Peterson's avatar Benjamin Peterson

test that depreacted methods give warnings

parent e1759f8d
...@@ -9,6 +9,7 @@ Still need testing: ...@@ -9,6 +9,7 @@ Still need testing:
import os import os
import re import re
import sys import sys
import warnings
from test import support from test import support
import unittest import unittest
from unittest import TestCase, TestProgram from unittest import TestCase, TestProgram
...@@ -2810,13 +2811,20 @@ test case ...@@ -2810,13 +2811,20 @@ test case
Do not use these methods. They will go away in 3.3. Do not use these methods. They will go away in 3.3.
""" """
self.failIfEqual(3, 5) old = (
self.failUnlessEqual(3, 3) (self.failIfEqual, (3, 5)),
self.failUnlessAlmostEqual(2.0, 2.0) (self.failUnlessEqual, (3, 3)),
self.failIfAlmostEqual(3.0, 5.0) (self.failUnlessAlmostEqual, (2.0, 2.0)),
self.failUnless(True) (self.failIfAlmostEqual, (3.0, 5.0)),
self.failUnlessRaises(TypeError, lambda _: 3.14 + 'spam') (self.failUnless, (True,)),
self.failIf(False) (self.failUnlessRaises, (TypeError, lambda _: 3.14 + 'spam')),
(self.failIf, (False,))
)
for meth, args in old:
with warnings.catch_warnings(record=True) as w:
meth(*args)
self.assertEqual(len(w), 1)
self.assertIs(w[0].category, DeprecationWarning)
def testDeepcopy(self): def testDeepcopy(self):
# Issue: 5660 # Issue: 5660
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment