def test_handshake_protocol_unsupported(log, message, transport):
 proto = 'chat'
 message.headers.extend(gen_ws_headers('test')[0])
 with log('aiohttp.websocket') as ctx:
  (_, _, _, _, protocol) = do_handshake(message.method, message.headers, transport, protocols=[proto])
  assert (protocol is None)
 assert (ctx.records[(-1)].msg == 'Client protocols %r don\xe2\x80\x99t overlap server-known ones %r')

def test_handshake_protocol_unsupported ( log , message , transport ) : proto = 'chat' message . headers . extend ( gen_ws_headers ( 'test' ) [ 0 ] ) with log ( 'aiohttp.websocket' ) as ctx : ( _ , _ , _ , _ , protocol ) = do_handshake ( message . method , message . headers , transport , protocols = [ proto ] ) assert ( protocol is None ) assert ( ctx . records [ ( - 1 ) ] . msg == 'Client protocols %r don\xe2\x80\x99t overlap server-known ones %r' )
tests if a protocol mismatch handshake warns and returns none .