11"""Tests for selector_events.py"""
22
33import collections
4- import sys
54import selectors
65import socket
6+ import sys
77import unittest
8+ from asyncio import selector_events
89from unittest import mock
10+
911try :
1012 import ssl
1113except ImportError :
1214 ssl = None
1315
1416import asyncio
15- from asyncio .selector_events import BaseSelectorEventLoop
16- from asyncio . selector_events import _SelectorTransport
17- from asyncio . selector_events import _SelectorSocketTransport
18- from asyncio . selector_events import _SelectorDatagramTransport
17+ from asyncio .selector_events import ( BaseSelectorEventLoop ,
18+ _SelectorDatagramTransport ,
19+ _SelectorSocketTransport ,
20+ _SelectorTransport )
1921from test .test_asyncio import utils as test_utils
2022
21-
2223MOCK_ANY = mock .ANY
2324
2425
@@ -746,7 +747,7 @@ def test_write_sendmsg_no_data(self):
746747 self .assertFalse (self .sock .sendmsg .called )
747748 self .assertEqual (list_to_buffer ([b'data' ]), transport ._buffer )
748749
749- @unittest .skipUnless (hasattr ( socket . socket , 'sendmsg' ) , 'no sendmsg' )
750+ @unittest .skipUnless (selector_events . HAVE_SENDMSG , 'no sendmsg' )
750751 def test_write_sendmsg_full (self ):
751752 data = memoryview (b'data' )
752753 self .sock .sendmsg = mock .Mock ()
@@ -759,7 +760,7 @@ def test_write_sendmsg_full(self):
759760 self .assertTrue (self .sock .sendmsg .called )
760761 self .assertFalse (self .loop .writers )
761762
762- @unittest .skipUnless (hasattr ( socket . socket , 'sendmsg' ) , 'no sendmsg' )
763+ @unittest .skipUnless (selector_events . HAVE_SENDMSG , 'no sendmsg' )
763764 def test_write_sendmsg_partial (self ):
764765
765766 data = memoryview (b'data' )
0 commit comments