diff options
author | Georg Brandl <georg@python.org> | 2010-07-28 08:19:35 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-07-28 08:19:35 (GMT) |
commit | cbb0ae4a428bae3f5c29a1f8974121bb195299ef (patch) | |
tree | 23b2d8b246b7dbaddf966dcf50ccbeca601fd173 /Lib/test/test_asyncore.py | |
parent | 8182b717dbedc5d864a2240e6ff9120ecb2607dc (diff) | |
download | cpython-cbb0ae4a428bae3f5c29a1f8974121bb195299ef.zip cpython-cbb0ae4a428bae3f5c29a1f8974121bb195299ef.tar.gz cpython-cbb0ae4a428bae3f5c29a1f8974121bb195299ef.tar.bz2 |
#9354: Provide getsockopt() in asyncore file_wrapper(). Patch by Lukas Langa.
Diffstat (limited to 'Lib/test/test_asyncore.py')
-rw-r--r-- | Lib/test/test_asyncore.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py index 5a1b83c..ce0a84f 100644 --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -428,6 +428,19 @@ class FileWrapperTest(unittest.TestCase): w.close() self.assertEqual(open(TESTFN, 'rb').read(), self.d + d1 + d2) + @unittest.skipUnless(hasattr(asyncore, 'file_dispatcher'), + 'asyncore.file_dispatcher required') + def test_dispatcher(self): + fd = os.open(TESTFN, os.O_RDONLY) + data = [] + class FileDispatcher(asyncore.file_dispatcher): + def handle_read(self): + data.append(self.recv(29)) + s = FileDispatcher(fd) + os.close(fd) + asyncore.loop(timeout=0.01, use_poll=True, count=2) + self.assertEqual(b"".join(data), self.d) + class BaseTestHandler(asyncore.dispatcher): |