Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
3d1706fa
Kaydet (Commit)
3d1706fa
authored
Agu 22, 2011
tarafından
Nadeem Vawda
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix deprecation warnings in test_socket.
üst
5c7f5c6c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
test_socket.py
Lib/test/test_socket.py
+14
-14
No files found.
Lib/test/test_socket.py
Dosyayı görüntüle @
3d1706fa
...
@@ -1884,7 +1884,7 @@ class RecvmsgIntoTests(RecvmsgIntoMixin, RecvmsgGenericTests):
...
@@ -1884,7 +1884,7 @@ class RecvmsgIntoTests(RecvmsgIntoMixin, RecvmsgGenericTests):
buf
=
array
.
array
(
"B"
,
[
0
]
*
len
(
MSG
))
buf
=
array
.
array
(
"B"
,
[
0
]
*
len
(
MSG
))
nbytes
,
ancdata
,
flags
,
addr
=
self
.
serv_sock
.
recvmsg_into
([
buf
])
nbytes
,
ancdata
,
flags
,
addr
=
self
.
serv_sock
.
recvmsg_into
([
buf
])
self
.
assertEqual
(
nbytes
,
len
(
MSG
))
self
.
assertEqual
(
nbytes
,
len
(
MSG
))
self
.
assertEqual
(
buf
.
to
string
(),
MSG
)
self
.
assertEqual
(
buf
.
to
bytes
(),
MSG
)
self
.
checkRecvmsgAddress
(
addr
,
self
.
cli_addr
)
self
.
checkRecvmsgAddress
(
addr
,
self
.
cli_addr
)
self
.
assertEqual
(
ancdata
,
[])
self
.
assertEqual
(
ancdata
,
[])
self
.
checkFlags
(
flags
,
eor
=
True
)
self
.
checkFlags
(
flags
,
eor
=
True
)
...
@@ -2002,7 +2002,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
...
@@ -2002,7 +2002,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
if
(
cmsg_level
==
socket
.
SOL_SOCKET
and
if
(
cmsg_level
==
socket
.
SOL_SOCKET
and
cmsg_type
==
socket
.
SCM_RIGHTS
):
cmsg_type
==
socket
.
SCM_RIGHTS
):
fds
=
array
.
array
(
"i"
)
fds
=
array
.
array
(
"i"
)
fds
.
from
string
(
cmsg_data
[:
fds
.
from
bytes
(
cmsg_data
[:
len
(
cmsg_data
)
-
(
len
(
cmsg_data
)
%
fds
.
itemsize
)])
len
(
cmsg_data
)
-
(
len
(
cmsg_data
)
%
fds
.
itemsize
)])
for
fd
in
fds
:
for
fd
in
fds
:
os
.
close
(
fd
)
os
.
close
(
fd
)
...
@@ -2039,7 +2039,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
...
@@ -2039,7 +2039,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
self
.
assertEqual
(
cmsg_type
,
socket
.
SCM_RIGHTS
)
self
.
assertEqual
(
cmsg_type
,
socket
.
SCM_RIGHTS
)
self
.
assertIsInstance
(
cmsg_data
,
bytes
)
self
.
assertIsInstance
(
cmsg_data
,
bytes
)
self
.
assertEqual
(
len
(
cmsg_data
)
%
SIZEOF_INT
,
0
)
self
.
assertEqual
(
len
(
cmsg_data
)
%
SIZEOF_INT
,
0
)
fds
.
from
string
(
cmsg_data
)
fds
.
from
bytes
(
cmsg_data
)
self
.
assertEqual
(
len
(
fds
),
numfds
)
self
.
assertEqual
(
len
(
fds
),
numfds
)
self
.
checkFDs
(
fds
)
self
.
checkFDs
(
fds
)
...
@@ -2055,7 +2055,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
...
@@ -2055,7 +2055,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
[
MSG
],
[
MSG
],
[(
socket
.
SOL_SOCKET
,
[(
socket
.
SOL_SOCKET
,
socket
.
SCM_RIGHTS
,
socket
.
SCM_RIGHTS
,
array
.
array
(
"i"
,
self
.
newFDs
(
1
))
.
to
string
())]),
array
.
array
(
"i"
,
self
.
newFDs
(
1
))
.
to
bytes
())]),
len
(
MSG
))
len
(
MSG
))
def
testMultipleFDPass
(
self
):
def
testMultipleFDPass
(
self
):
...
@@ -2173,7 +2173,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
...
@@ -2173,7 +2173,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
MSG
,
MSG
,
[(
socket
.
SOL_SOCKET
,
[(
socket
.
SOL_SOCKET
,
socket
.
SCM_RIGHTS
,
socket
.
SCM_RIGHTS
,
array
.
array
(
"i"
,
[
self
.
badfd
])
.
to
string
()[:
-
1
])])
array
.
array
(
"i"
,
[
self
.
badfd
])
.
to
bytes
()[:
-
1
])])
@requireAttrs
(
socket
,
"CMSG_SPACE"
)
@requireAttrs
(
socket
,
"CMSG_SPACE"
)
def
testFDPassPartialIntInMiddle
(
self
):
def
testFDPassPartialIntInMiddle
(
self
):
...
@@ -2189,7 +2189,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
...
@@ -2189,7 +2189,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
for
cmsg_level
,
cmsg_type
,
cmsg_data
in
ancdata
:
for
cmsg_level
,
cmsg_type
,
cmsg_data
in
ancdata
:
self
.
assertEqual
(
cmsg_level
,
socket
.
SOL_SOCKET
)
self
.
assertEqual
(
cmsg_level
,
socket
.
SOL_SOCKET
)
self
.
assertEqual
(
cmsg_type
,
socket
.
SCM_RIGHTS
)
self
.
assertEqual
(
cmsg_type
,
socket
.
SCM_RIGHTS
)
fds
.
from
string
(
cmsg_data
[:
fds
.
from
bytes
(
cmsg_data
[:
len
(
cmsg_data
)
-
(
len
(
cmsg_data
)
%
fds
.
itemsize
)])
len
(
cmsg_data
)
-
(
len
(
cmsg_data
)
%
fds
.
itemsize
)])
self
.
assertLessEqual
(
len
(
fds
),
2
)
self
.
assertLessEqual
(
len
(
fds
),
2
)
self
.
checkFDs
(
fds
)
self
.
checkFDs
(
fds
)
...
@@ -2201,7 +2201,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
...
@@ -2201,7 +2201,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
MSG
,
MSG
,
[(
socket
.
SOL_SOCKET
,
[(
socket
.
SOL_SOCKET
,
socket
.
SCM_RIGHTS
,
socket
.
SCM_RIGHTS
,
array
.
array
(
"i"
,
[
fd0
,
self
.
badfd
])
.
to
string
()[:
-
1
]),
array
.
array
(
"i"
,
[
fd0
,
self
.
badfd
])
.
to
bytes
()[:
-
1
]),
(
socket
.
SOL_SOCKET
,
(
socket
.
SOL_SOCKET
,
socket
.
SCM_RIGHTS
,
socket
.
SCM_RIGHTS
,
array
.
array
(
"i"
,
[
fd1
]))])
array
.
array
(
"i"
,
[
fd1
]))])
...
@@ -2285,7 +2285,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
...
@@ -2285,7 +2285,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
self
.
assertGreaterEqual
(
len
(
cmsg_data
),
mindata
)
self
.
assertGreaterEqual
(
len
(
cmsg_data
),
mindata
)
self
.
assertLessEqual
(
len
(
cmsg_data
),
maxdata
)
self
.
assertLessEqual
(
len
(
cmsg_data
),
maxdata
)
fds
=
array
.
array
(
"i"
)
fds
=
array
.
array
(
"i"
)
fds
.
from
string
(
cmsg_data
[:
fds
.
from
bytes
(
cmsg_data
[:
len
(
cmsg_data
)
-
(
len
(
cmsg_data
)
%
fds
.
itemsize
)])
len
(
cmsg_data
)
-
(
len
(
cmsg_data
)
%
fds
.
itemsize
)])
self
.
checkFDs
(
fds
)
self
.
checkFDs
(
fds
)
...
@@ -2367,7 +2367,7 @@ class RFC3542AncillaryTest(SendrecvmsgServerTimeoutBase):
...
@@ -2367,7 +2367,7 @@ class RFC3542AncillaryTest(SendrecvmsgServerTimeoutBase):
self
.
assertIsInstance
(
cmsg_data
,
bytes
)
self
.
assertIsInstance
(
cmsg_data
,
bytes
)
self
.
assertEqual
(
len
(
cmsg_data
),
SIZEOF_INT
)
self
.
assertEqual
(
len
(
cmsg_data
),
SIZEOF_INT
)
a
=
array
.
array
(
"i"
)
a
=
array
.
array
(
"i"
)
a
.
from
string
(
cmsg_data
)
a
.
from
bytes
(
cmsg_data
)
self
.
assertGreaterEqual
(
a
[
0
],
0
)
self
.
assertGreaterEqual
(
a
[
0
],
0
)
self
.
assertLessEqual
(
a
[
0
],
maxhop
)
self
.
assertLessEqual
(
a
[
0
],
maxhop
)
...
@@ -2440,14 +2440,14 @@ class RFC3542AncillaryTest(SendrecvmsgServerTimeoutBase):
...
@@ -2440,14 +2440,14 @@ class RFC3542AncillaryTest(SendrecvmsgServerTimeoutBase):
tcdata
=
ancmap
[(
socket
.
IPPROTO_IPV6
,
socket
.
IPV6_TCLASS
)]
tcdata
=
ancmap
[(
socket
.
IPPROTO_IPV6
,
socket
.
IPV6_TCLASS
)]
self
.
assertEqual
(
len
(
tcdata
),
SIZEOF_INT
)
self
.
assertEqual
(
len
(
tcdata
),
SIZEOF_INT
)
a
=
array
.
array
(
"i"
)
a
=
array
.
array
(
"i"
)
a
.
from
string
(
tcdata
)
a
.
from
bytes
(
tcdata
)
self
.
assertGreaterEqual
(
a
[
0
],
0
)
self
.
assertGreaterEqual
(
a
[
0
],
0
)
self
.
assertLessEqual
(
a
[
0
],
255
)
self
.
assertLessEqual
(
a
[
0
],
255
)
hldata
=
ancmap
[(
socket
.
IPPROTO_IPV6
,
socket
.
IPV6_HOPLIMIT
)]
hldata
=
ancmap
[(
socket
.
IPPROTO_IPV6
,
socket
.
IPV6_HOPLIMIT
)]
self
.
assertEqual
(
len
(
hldata
),
SIZEOF_INT
)
self
.
assertEqual
(
len
(
hldata
),
SIZEOF_INT
)
a
=
array
.
array
(
"i"
)
a
=
array
.
array
(
"i"
)
a
.
from
string
(
hldata
)
a
.
from
bytes
(
hldata
)
self
.
assertGreaterEqual
(
a
[
0
],
0
)
self
.
assertGreaterEqual
(
a
[
0
],
0
)
self
.
assertLessEqual
(
a
[
0
],
maxhop
)
self
.
assertLessEqual
(
a
[
0
],
maxhop
)
...
@@ -2512,7 +2512,7 @@ class RFC3542AncillaryTest(SendrecvmsgServerTimeoutBase):
...
@@ -2512,7 +2512,7 @@ class RFC3542AncillaryTest(SendrecvmsgServerTimeoutBase):
nbytes
=
self
.
sendmsgToServer
(
nbytes
=
self
.
sendmsgToServer
(
[
MSG
],
[
MSG
],
[(
socket
.
IPPROTO_IPV6
,
socket
.
IPV6_TCLASS
,
[(
socket
.
IPPROTO_IPV6
,
socket
.
IPV6_TCLASS
,
array
.
array
(
"i"
,
[
self
.
traffic_class
])
.
to
string
()
+
b
"
\x00
"
),
array
.
array
(
"i"
,
[
self
.
traffic_class
])
.
to
bytes
()
+
b
"
\x00
"
),
(
socket
.
IPPROTO_IPV6
,
socket
.
IPV6_HOPLIMIT
,
(
socket
.
IPPROTO_IPV6
,
socket
.
IPV6_HOPLIMIT
,
array
.
array
(
"i"
,
[
self
.
hop_limit
]))])
array
.
array
(
"i"
,
[
self
.
hop_limit
]))])
except
socket
.
error
as
e
:
except
socket
.
error
as
e
:
...
@@ -2658,7 +2658,7 @@ class RFC3542AncillaryTest(SendrecvmsgServerTimeoutBase):
...
@@ -2658,7 +2658,7 @@ class RFC3542AncillaryTest(SendrecvmsgServerTimeoutBase):
self
.
assertIn
(
cmsg_type
,
{
socket
.
IPV6_TCLASS
,
socket
.
IPV6_HOPLIMIT
})
self
.
assertIn
(
cmsg_type
,
{
socket
.
IPV6_TCLASS
,
socket
.
IPV6_HOPLIMIT
})
self
.
assertEqual
(
len
(
cmsg_data
),
SIZEOF_INT
)
self
.
assertEqual
(
len
(
cmsg_data
),
SIZEOF_INT
)
a
=
array
.
array
(
"i"
)
a
=
array
.
array
(
"i"
)
a
.
from
string
(
cmsg_data
)
a
.
from
bytes
(
cmsg_data
)
self
.
assertGreaterEqual
(
a
[
0
],
0
)
self
.
assertGreaterEqual
(
a
[
0
],
0
)
self
.
assertLessEqual
(
a
[
0
],
255
)
self
.
assertLessEqual
(
a
[
0
],
255
)
...
@@ -2732,7 +2732,7 @@ class RFC3542AncillaryTest(SendrecvmsgServerTimeoutBase):
...
@@ -2732,7 +2732,7 @@ class RFC3542AncillaryTest(SendrecvmsgServerTimeoutBase):
cmsg_types
.
remove
(
cmsg_type
)
cmsg_types
.
remove
(
cmsg_type
)
self
.
assertEqual
(
len
(
cmsg_data
),
SIZEOF_INT
)
self
.
assertEqual
(
len
(
cmsg_data
),
SIZEOF_INT
)
a
=
array
.
array
(
"i"
)
a
=
array
.
array
(
"i"
)
a
.
from
string
(
cmsg_data
)
a
.
from
bytes
(
cmsg_data
)
self
.
assertGreaterEqual
(
a
[
0
],
0
)
self
.
assertGreaterEqual
(
a
[
0
],
0
)
self
.
assertLessEqual
(
a
[
0
],
255
)
self
.
assertLessEqual
(
a
[
0
],
255
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment