From: Victor Stinner Date: Mon, 7 Jul 2014 22:19:33 +0000 (+0200) Subject: (Merge 3.4) asynchat: PEP8-ify the code X-Git-Tag: v3.5.0a1~1319 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7b9328f51bee311ff943af660f3b5f1b35d4e196;p=thirdparty%2FPython%2Fcpython.git (Merge 3.4) asynchat: PEP8-ify the code --- 7b9328f51bee311ff943af660f3b5f1b35d4e196 diff --cc Lib/asynchat.py index e5337f7e7c81,682dbd73140f..91f0bb2fd9c1 --- a/Lib/asynchat.py +++ b/Lib/asynchat.py @@@ -276,11 -280,9 +280,12 @@@ class simple_producer self.data = b'' return result + class fifo: - def __init__ (self, list=None): + def __init__(self, list=None): + import warnings + warnings.warn('fifo class will be removed in Python 3.6', + DeprecationWarning, stacklevel=2) if not list: self.list = deque() else: diff --cc Lib/test/test_asynchat.py index 23944d78d4f7,34717399d562..f6b17f9f36ed --- a/Lib/test/test_asynchat.py +++ b/Lib/test/test_asynchat.py @@@ -5,10 -5,12 +5,13 @@@ from test import suppor # If this fails, the test will be skipped. thread = support.import_module('_thread') - import asyncore, asynchat, socket, time - import unittest + import asynchat + import asyncore + import socket import sys + import time + import unittest +import warnings try: import threading except ImportError: @@@ -275,12 -278,10 +279,13 @@@ class TestHelperFunctions(unittest.Test self.assertEqual(asynchat.find_prefix_at_end("qwerty\r", "\r\n"), 1) self.assertEqual(asynchat.find_prefix_at_end("qwertydkjf", "\r\n"), 0) + class TestFifo(unittest.TestCase): def test_basic(self): - f = asynchat.fifo() + with warnings.catch_warnings(record=True) as w: + f = asynchat.fifo() + if w: + assert issubclass(w[0].category, DeprecationWarning) f.push(7) f.push(b'a') self.assertEqual(len(f), 2)