Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fe71bb7

Browse files
author
Erlend E. Aasland
committed
bpo-35569: Add unit tests
1 parent ae17650 commit fe71bb7

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Lib/test/test_socket.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,37 @@ def testWindowsSpecificConstants(self):
947947
socket.IPPROTO_L2TP
948948
socket.IPPROTO_SCTP
949949

950+
@unittest.skipUnless(sys.platform == 'darwin', 'macOS specific test')
951+
@unittest.skipUnless(support.IPV6_ENABLED, 'IPv6 required for this test')
952+
def test3542SocketOptions(self):
953+
# Ref. issue #35569 and https://tools.ietf.org/html/rfc3542
954+
opts = {
955+
'IPV6_CHECKSUM',
956+
'IPV6_DONTFRAG',
957+
'IPV6_DSTOPTS',
958+
'IPV6_HOPLIMIT',
959+
'IPV6_HOPOPTS',
960+
'IPV6_NEXTHOP',
961+
'IPV6_PATHMTU',
962+
'IPV6_PKTINFO',
963+
'IPV6_RECVDSTOPTS',
964+
'IPV6_RECVHOPLIMIT',
965+
'IPV6_RECVHOPOPTS',
966+
'IPV6_RECVPATHMTU',
967+
'IPV6_RECVPKTINFO',
968+
'IPV6_RECVRTHDR',
969+
'IPV6_RECVTCLASS',
970+
'IPV6_RTHDR',
971+
'IPV6_RTHDRDSTOPTS',
972+
'IPV6_RTHDR_TYPE_0',
973+
'IPV6_TCLASS',
974+
'IPV6_USE_MIN_MTU',
975+
}
976+
for opt in opts:
977+
self.assertTrue(
978+
hasattr(socket, opt), f"Missing RFC3542 socket option '{opt}'"
979+
)
980+
950981
def testHostnameRes(self):
951982
# Testing hostname resolution mechanisms
952983
hostname = socket.gethostname()

0 commit comments

Comments
 (0)