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
be1bc8c4
Commit
be1bc8c4
authored
Jun 01, 2012
by
Sandro Tosi
Browse files
Options
Browse Files
Download
Plain Diff
merge heads
parents
c10584a0
35db5131
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
Lib/ipaddress.py
Lib/ipaddress.py
+1
-1
Lib/test/test_ipaddress.py
Lib/test/test_ipaddress.py
+11
-4
No files found.
Lib/ipaddress.py
View file @
be1bc8c4
...
...
@@ -359,7 +359,7 @@ def collapse_addresses(addresses):
else
:
if
nets
and
nets
[
-
1
].
_version
!=
ip
.
_version
:
raise
TypeError
(
"%s and %s are not of the same version"
%
(
str
(
ip
),
str
(
ip
s
[
-
1
])))
str
(
ip
),
str
(
net
s
[
-
1
])))
nets
.
append
(
ip
)
# sort and dedup
...
...
Lib/test/test_ipaddress.py
View file @
be1bc8c4
...
...
@@ -596,10 +596,17 @@ class IpaddrUnitTest(unittest.TestCase):
self
.
assertEqual
(
list
(
collapsed
),
[
ip3
])
# the toejam test
ip1
=
ipaddress
.
ip_address
(
'1.1.1.1'
)
ip2
=
ipaddress
.
ip_address
(
'::1'
)
self
.
assertRaises
(
TypeError
,
ipaddress
.
collapse_addresses
,
[
ip1
,
ip2
])
addr_tuples
=
[
(
ipaddress
.
ip_address
(
'1.1.1.1'
),
ipaddress
.
ip_address
(
'::1'
)),
(
ipaddress
.
IPv4Network
(
'1.1.0.0/24'
),
ipaddress
.
IPv6Network
(
'2001::/120'
)),
(
ipaddress
.
IPv4Network
(
'1.1.0.0/32'
),
ipaddress
.
IPv6Network
(
'2001::/128'
)),
]
for
ip1
,
ip2
in
addr_tuples
:
self
.
assertRaises
(
TypeError
,
ipaddress
.
collapse_addresses
,
[
ip1
,
ip2
])
def
testSummarizing
(
self
):
#ip = ipaddress.ip_address
...
...
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