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
81319a81
Commit
81319a81
authored
Sep 13, 2019
by
Zackery Spytz
Committed by
Benjamin Peterson
Sep 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-37199: Replace the early returns added in
c2cda638
. (GH-14535)
parent
f3095b0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
37 deletions
+34
-37
Lib/test/test_asyncio/test_base_events.py
Lib/test/test_asyncio/test_base_events.py
+34
-37
No files found.
Lib/test/test_asyncio/test_base_events.py
View file @
81319a81
...
@@ -91,28 +91,26 @@ class BaseEventTests(test_utils.TestCase):
...
@@ -91,28 +91,26 @@ class BaseEventTests(test_utils.TestCase):
self
.
assertIsNone
(
self
.
assertIsNone
(
base_events
.
_ipaddr_info
(
'1.2.3.4'
,
1
,
UNSPEC
,
0
,
0
))
base_events
.
_ipaddr_info
(
'1.2.3.4'
,
1
,
UNSPEC
,
0
,
0
))
if
not
support
.
IPV6_ENABLED
:
if
support
.
IPV6_ENABLED
:
return
# IPv4 address with family IPv6.
self
.
assertIsNone
(
base_events
.
_ipaddr_info
(
'1.2.3.4'
,
1
,
INET6
,
STREAM
,
TCP
))
# IPv4 address with family IPv6.
self
.
assertEqual
(
self
.
assertIsNone
(
(
INET6
,
STREAM
,
TCP
,
''
,
(
'::3'
,
1
,
0
,
0
)),
base_events
.
_ipaddr_info
(
'1.2.3.4'
,
1
,
INET6
,
STREAM
,
TCP
))
base_events
.
_ipaddr_info
(
'::3'
,
1
,
INET6
,
STREAM
,
TCP
))
self
.
assertEqual
(
(
INET6
,
STREAM
,
TCP
,
''
,
(
'::3'
,
1
,
0
,
0
)),
base_events
.
_ipaddr_info
(
'::3'
,
1
,
INET6
,
STREAM
,
TCP
))
self
.
assertEqual
(
self
.
assertEqual
(
(
INET6
,
STREAM
,
TCP
,
''
,
(
'::3'
,
1
,
0
,
0
)),
(
INET6
,
STREAM
,
TCP
,
''
,
(
'::3'
,
1
,
0
,
0
)),
base_events
.
_ipaddr_info
(
'::3'
,
1
,
UNSPEC
,
STREAM
,
TCP
))
base_events
.
_ipaddr_info
(
'::3'
,
1
,
UNSPEC
,
STREAM
,
TCP
))
# IPv6 address with family IPv4.
# IPv6 address with family IPv4.
self
.
assertIsNone
(
self
.
assertIsNone
(
base_events
.
_ipaddr_info
(
'::3'
,
1
,
INET
,
STREAM
,
TCP
))
base_events
.
_ipaddr_info
(
'::3'
,
1
,
INET
,
STREAM
,
TCP
))
# IPv6 address with zone index.
# IPv6 address with zone index.
self
.
assertIsNone
(
self
.
assertIsNone
(
base_events
.
_ipaddr_info
(
'::3%lo0'
,
1
,
INET6
,
STREAM
,
TCP
))
base_events
.
_ipaddr_info
(
'::3%lo0'
,
1
,
INET6
,
STREAM
,
TCP
))
def
test_port_parameter_types
(
self
):
def
test_port_parameter_types
(
self
):
# Test obscure kinds of arguments for "port".
# Test obscure kinds of arguments for "port".
...
@@ -1284,25 +1282,24 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase):
...
@@ -1284,25 +1282,24 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase):
t
.
close
()
t
.
close
()
test_utils
.
run_briefly
(
self
.
loop
)
# allow transport to close
test_utils
.
run_briefly
(
self
.
loop
)
# allow transport to close
if
not
support
.
IPV6_ENABLED
:
if
support
.
IPV6_ENABLED
:
return
sock
.
family
=
socket
.
AF_INET6
coro
=
self
.
loop
.
create_connection
(
asyncio
.
Protocol
,
'::1'
,
80
)
sock
.
family
=
socket
.
AF_INET6
t
,
p
=
self
.
loop
.
run_until_complete
(
coro
)
coro
=
self
.
loop
.
create_connection
(
asyncio
.
Protocol
,
'::1'
,
80
)
try
:
t
,
p
=
self
.
loop
.
run_until_complete
(
coro
)
# Without inet_pton we use getaddrinfo, which transforms
try
:
# ('::1', 80) to ('::1', 80, 0, 0). The last 0s are flow info,
# Without inet_pton we use getaddrinfo, which transforms ('::1', 80)
# scope id.
# to ('::1', 80, 0, 0). The last 0s are flow info, scope id.
[
address
]
=
sock
.
connect
.
call_args
[
0
]
[
address
]
=
sock
.
connect
.
call_args
[
0
]
host
,
port
=
address
[:
2
]
host
,
port
=
address
[:
2
]
self
.
assertRegex
(
host
,
r'::(0\
.)*
1'
)
self
.
assertRegex
(
host
,
r'::(0\
.)*
1'
)
self
.
assertEqual
(
port
,
80
)
self
.
assertEqual
(
port
,
80
)
_
,
kwargs
=
m_socket
.
socket
.
call_args
_
,
kwargs
=
m_socket
.
socket
.
call_args
self
.
assertEqual
(
kwargs
[
'family'
],
m_socket
.
AF_INET6
)
self
.
assertEqual
(
kwargs
[
'family'
],
m_socket
.
AF_INET6
)
self
.
assertEqual
(
kwargs
[
'type'
],
m_socket
.
SOCK_STREAM
)
self
.
assertEqual
(
kwargs
[
'type'
],
m_socket
.
SOCK_STREAM
)
finally
:
finally
:
t
.
close
()
t
.
close
()
test_utils
.
run_briefly
(
self
.
loop
)
# allow transport to close
test_utils
.
run_briefly
(
self
.
loop
)
# allow transport to close
@
unittest
.
skipUnless
(
support
.
IPV6_ENABLED
,
'no IPv6 support'
)
@
unittest
.
skipUnless
(
support
.
IPV6_ENABLED
,
'no IPv6 support'
)
@
unittest
.
skipIf
(
sys
.
platform
.
startswith
(
'aix'
),
@
unittest
.
skipIf
(
sys
.
platform
.
startswith
(
'aix'
),
...
...
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