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
ab659966
Kaydet (Commit)
ab659966
authored
Haz 12, 2002
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove some overly complicated ways to concatenate and repeat strings
using "".join(). Fold a long line.
üst
284a2cf0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
test_socket.py
Lib/test/test_socket.py
+7
-6
No files found.
Lib/test/test_socket.py
Dosyayı görüntüle @
ab659966
...
@@ -51,8 +51,9 @@ class ThreadableTest:
...
@@ -51,8 +51,9 @@ class ThreadableTest:
self
.
queue
=
Queue
.
Queue
(
1
)
self
.
queue
=
Queue
.
Queue
(
1
)
# Do some munging to start the client test.
# Do some munging to start the client test.
test_method
=
getattr
(
self
,
''
.
join
((
'_'
,
self
.
_TestCase__testMethodName
)))
test_method
=
getattr
(
self
,
'_'
+
self
.
_TestCase__testMethodName
)
self
.
client_thread
=
thread
.
start_new_thread
(
self
.
clientRun
,
(
test_method
,
))
self
.
client_thread
=
thread
.
start_new_thread
(
self
.
clientRun
,
(
test_method
,))
self
.
__setUp
()
self
.
__setUp
()
self
.
ready
.
wait
()
self
.
ready
.
wait
()
...
@@ -281,7 +282,7 @@ class BasicTCPTest(SocketConnectedTest):
...
@@ -281,7 +282,7 @@ class BasicTCPTest(SocketConnectedTest):
"""Testing receive in chunks over TCP."""
"""Testing receive in chunks over TCP."""
seg1
=
self
.
cli_conn
.
recv
(
len
(
MSG
)
-
3
)
seg1
=
self
.
cli_conn
.
recv
(
len
(
MSG
)
-
3
)
seg2
=
self
.
cli_conn
.
recv
(
1024
)
seg2
=
self
.
cli_conn
.
recv
(
1024
)
msg
=
''
.
join
((
seg1
,
seg2
))
msg
=
seg1
+
seg2
self
.
assertEqual
(
msg
,
MSG
)
self
.
assertEqual
(
msg
,
MSG
)
def
_testOverFlowRecv
(
self
):
def
_testOverFlowRecv
(
self
):
...
@@ -301,7 +302,7 @@ class BasicTCPTest(SocketConnectedTest):
...
@@ -301,7 +302,7 @@ class BasicTCPTest(SocketConnectedTest):
"""Testing recvfrom() in chunks over TCP."""
"""Testing recvfrom() in chunks over TCP."""
seg1
,
addr
=
self
.
cli_conn
.
recvfrom
(
len
(
MSG
)
-
3
)
seg1
,
addr
=
self
.
cli_conn
.
recvfrom
(
len
(
MSG
)
-
3
)
seg2
,
addr
=
self
.
cli_conn
.
recvfrom
(
1024
)
seg2
,
addr
=
self
.
cli_conn
.
recvfrom
(
1024
)
msg
=
''
.
join
((
seg1
,
seg2
))
msg
=
seg1
+
seg2
hostname
,
port
=
addr
hostname
,
port
=
addr
##self.assertEqual(hostname, socket.gethostbyname('localhost'))
##self.assertEqual(hostname, socket.gethostbyname('localhost'))
self
.
assertEqual
(
msg
,
MSG
)
self
.
assertEqual
(
msg
,
MSG
)
...
@@ -320,7 +321,7 @@ class BasicTCPTest(SocketConnectedTest):
...
@@ -320,7 +321,7 @@ class BasicTCPTest(SocketConnectedTest):
self
.
assert_
(
len
(
read
)
==
1024
,
"Error performing sendall."
)
self
.
assert_
(
len
(
read
)
==
1024
,
"Error performing sendall."
)
def
_testSendAll
(
self
):
def
_testSendAll
(
self
):
big_chunk
=
'
'
.
join
([
'f'
]
*
2048
)
big_chunk
=
'
f'
*
2048
self
.
serv_conn
.
sendall
(
big_chunk
)
self
.
serv_conn
.
sendall
(
big_chunk
)
def
testFromFd
(
self
):
def
testFromFd
(
self
):
...
@@ -473,7 +474,7 @@ class FileObjectClassTestCase(SocketConnectedTest):
...
@@ -473,7 +474,7 @@ class FileObjectClassTestCase(SocketConnectedTest):
"""Performing small file read test."""
"""Performing small file read test."""
first_seg
=
self
.
serv_file
.
read
(
len
(
MSG
)
-
3
)
first_seg
=
self
.
serv_file
.
read
(
len
(
MSG
)
-
3
)
second_seg
=
self
.
serv_file
.
read
(
3
)
second_seg
=
self
.
serv_file
.
read
(
3
)
msg
=
''
.
join
((
first_seg
,
second_seg
))
msg
=
first_seg
+
second_seg
self
.
assertEqual
(
msg
,
MSG
)
self
.
assertEqual
(
msg
,
MSG
)
def
_testSmallRead
(
self
):
def
_testSmallRead
(
self
):
...
...
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