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:
# 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:
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)