diff options
author | Giampaolo Rodola' <g.rodola@gmail.com> | 2014-06-21 11:58:30 (GMT) |
---|---|---|
committer | Giampaolo Rodola' <g.rodola@gmail.com> | 2014-06-21 11:58:30 (GMT) |
commit | bd0487694c0ce55ae9d425fe9e13e21878a7d6dc (patch) | |
tree | b435cbd28d74a6efa65ade245b3d73ae03f78861 /Lib/test/test_asynchat.py | |
parent | 892051af95729098ce4f5fc7f17ca7049c100b14 (diff) | |
download | cpython-bd0487694c0ce55ae9d425fe9e13e21878a7d6dc.zip cpython-bd0487694c0ce55ae9d425fe9e13e21878a7d6dc.tar.gz cpython-bd0487694c0ce55ae9d425fe9e13e21878a7d6dc.tar.bz2 |
#6916: raise a deprecation warning if using asynchat.fifo
Diffstat (limited to 'Lib/test/test_asynchat.py')
-rw-r--r-- | Lib/test/test_asynchat.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/test_asynchat.py b/Lib/test/test_asynchat.py index f93a52d..dd606d6 100644 --- a/Lib/test/test_asynchat.py +++ b/Lib/test/test_asynchat.py @@ -8,6 +8,7 @@ thread = support.import_module('_thread') import asyncore, asynchat, socket, time import unittest import sys +import warnings try: import threading except ImportError: @@ -260,7 +261,9 @@ class TestHelperFunctions(unittest.TestCase): class TestFifo(unittest.TestCase): def test_basic(self): - f = asynchat.fifo() + with warnings.catch_warnings(record=True) as w: + f = asynchat.fifo() + assert issubclass(w[0].category, DeprecationWarning) f.push(7) f.push(b'a') self.assertEqual(len(f), 2) @@ -275,7 +278,9 @@ class TestFifo(unittest.TestCase): self.assertEqual(f.pop(), (0, None)) def test_given_list(self): - f = asynchat.fifo([b'x', 17, 3]) + with warnings.catch_warnings(record=True) as w: + f = asynchat.fifo([b'x', 17, 3]) + assert issubclass(w[0].category, DeprecationWarning) self.assertEqual(len(f), 3) self.assertEqual(f.pop(), (1, b'x')) self.assertEqual(f.pop(), (1, 17)) |