]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
(Merge 3.4) asynchat: PEP8-ify the code
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 7 Jul 2014 22:19:33 +0000 (00:19 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 7 Jul 2014 22:19:33 +0000 (00:19 +0200)
1  2 
Lib/asynchat.py
Lib/test/test_asynchat.py

diff --cc Lib/asynchat.py
index e5337f7e7c81810dbee55af261757a280c22a4e2,682dbd73140fbb05c92b3a9edde262ab4286aa6a..91f0bb2fd9c12f7a5e422133129ef177956aba35
@@@ -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:
index 23944d78d4f7925f969f4ecdccf7c6a293edc7e7,34717399d562fd84e59d18672db47665bf52c2bc..f6b17f9f36ed5b686470b07c0f0cc79b336e6a82
@@@ -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)