Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a2627afe
Commit
a2627afe
authored
Sep 14, 2002
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Maybe this fixes test_socket on 64-bit Linux.
parent
92cfaf68
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
Lib/test/test_socket.py
Lib/test/test_socket.py
+13
-9
No files found.
Lib/test/test_socket.py
View file @
a2627afe
...
...
@@ -248,15 +248,19 @@ class GeneralModuleTests(unittest.TestCase):
except
socket
.
error
:
pass
def
testNtoH
(
self
):
for
func
in
socket
.
htonl
,
socket
.
ntohl
:
for
i
in
(
0
,
1
,
~
0xffff
,
2L
):
self
.
assertEqual
(
i
,
func
(
func
(
i
)))
biglong
=
2
**
32L
-
1
swapped
=
func
(
biglong
)
self
.
assert_
(
swapped
==
biglong
or
swapped
==
-
1
)
self
.
assertRaises
(
OverflowError
,
func
,
2L
**
34
)
def
testNtoHL
(
self
):
# This just checks that htons etc. are their own inverse,
# when looking at the lower 16 or 32 bits.
sizes
=
{
socket
.
htonl
:
32
,
socket
.
ntohl
:
32
,
socket
.
htons
:
16
,
socket
.
ntohs
:
16
}
for
func
,
size
in
sizes
.
items
():
mask
=
(
1L
<<
size
)
-
1
for
i
in
(
0
,
1
,
0xffff
,
~
0xffff
,
2
,
0x01234567
,
0x76543210
):
self
.
assertEqual
(
i
&
mask
,
func
(
func
(
i
&
mask
))
&
mask
)
swapped
=
func
(
mask
)
self
.
assertEqual
(
swapped
&
mask
,
mask
)
self
.
assertRaises
(
OverflowError
,
func
,
1L
<<
34
)
def
testGetServByName
(
self
):
# Testing getservbyname()
...
...
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