diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2014-07-09 00:12:23 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2014-07-09 00:12:23 (GMT) |
commit | e4857f35285f15a80313bce7c0618cd3bad360d0 (patch) | |
tree | 1ac33830e561f979c76852d348181d6227ef3637 /Lib/test | |
parent | 416b516d46d91316b22c2651a47ad3d7613834a4 (diff) | |
download | cpython-e4857f35285f15a80313bce7c0618cd3bad360d0.zip cpython-e4857f35285f15a80313bce7c0618cd3bad360d0.tar.gz cpython-e4857f35285f15a80313bce7c0618cd3bad360d0.tar.bz2 |
Issue #6916: Use assertWarns in test_asynchat.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_asynchat.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/test/test_asynchat.py b/Lib/test/test_asynchat.py index 9e30573..fd64adc 100644 --- a/Lib/test/test_asynchat.py +++ b/Lib/test/test_asynchat.py @@ -282,10 +282,10 @@ class TestHelperFunctions(unittest.TestCase): class TestFifo(unittest.TestCase): def test_basic(self): - with warnings.catch_warnings(record=True) as w: + with self.assertWarns(DeprecationWarning) as cm: f = asynchat.fifo() - if w: - assert issubclass(w[0].category, DeprecationWarning) + self.assertEqual(str(cm.warning), + "fifo class will be removed in Python 3.6") f.push(7) f.push(b'a') self.assertEqual(len(f), 2) @@ -300,10 +300,10 @@ class TestFifo(unittest.TestCase): self.assertEqual(f.pop(), (0, None)) def test_given_list(self): - with warnings.catch_warnings(record=True) as w: + with self.assertWarns(DeprecationWarning) as cm: f = asynchat.fifo([b'x', 17, 3]) - if w: - assert issubclass(w[0].category, DeprecationWarning) + self.assertEqual(str(cm.warning), + "fifo class will be removed in Python 3.6") self.assertEqual(len(f), 3) self.assertEqual(f.pop(), (1, b'x')) self.assertEqual(f.pop(), (1, 17)) |