@retry_on_failure
def test_getprotobyname():
 proto_map = {'icmp': socket.IPPROTO_ICMP, 'ip': socket.IPPROTO_IP, 'tcp': socket.IPPROTO_TCP, 'udp': socket.IPPROTO_UDP}
 if is_cli:
  proto_map.update({'dstopts': socket.IPPROTO_DSTOPTS, 'none': socket.IPPROTO_NONE, 'raw': socket.IPPROTO_RAW, 'ipv4': socket.IPPROTO_IPV4, 'ipv6': socket.IPPROTO_IPV6, 'esp': socket.IPPROTO_ESP, 'fragment': socket.IPPROTO_FRAGMENT, 'nd': socket.IPPROTO_ND, 'icmpv6': socket.IPPROTO_ICMPV6, 'routing': socket.IPPROTO_ROUTING, 'pup': socket.IPPROTO_PUP, 'ggp': socket.IPPROTO_GGP})
 for (proto_name, good_val) in proto_map.iteritems():
  temp_val = socket.getprotobyname(proto_name)
  AreEqual(temp_val, good_val)
 bad_list = ['', 'blah', 'i']
 for name in bad_list:
  AssertError(socket.error, socket.getprotobyname, name)

@ retry_on_failure def test_getprotobyname ( ) : proto_map = { 'icmp' : socket . IPPROTO_ICMP , 'ip' : socket . IPPROTO_IP , 'tcp' : socket . IPPROTO_TCP , 'udp' : socket . IPPROTO_UDP } if is_cli : proto_map . update ( { 'dstopts' : socket . IPPROTO_DSTOPTS , 'none' : socket . IPPROTO_NONE , 'raw' : socket . IPPROTO_RAW , 'ipv4' : socket . IPPROTO_IPV4 , 'ipv6' : socket . IPPROTO_IPV6 , 'esp' : socket . IPPROTO_ESP , 'fragment' : socket . IPPROTO_FRAGMENT , 'nd' : socket . IPPROTO_ND , 'icmpv6' : socket . IPPROTO_ICMPV6 , 'routing' : socket . IPPROTO_ROUTING , 'pup' : socket . IPPROTO_PUP , 'ggp' : socket . IPPROTO_GGP } ) for ( proto_name , good_val ) in proto_map . iteritems ( ) : temp_val = socket . getprotobyname ( proto_name ) AreEqual ( temp_val , good_val ) bad_list = [ '' , 'blah' , 'i' ] for name in bad_list : AssertError ( socket . error , socket . getprotobyname , name )
tests socket .