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
947ff387
Commit
947ff387
authored
Jun 02, 2016
by
R David Murray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#20973: add total ordering tests for ipaddress
Patch by Tommy Beadle.
parent
f5854148
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
Lib/test/test_ipaddress.py
Lib/test/test_ipaddress.py
+33
-0
Misc/ACKS
Misc/ACKS
+1
-0
No files found.
Lib/test/test_ipaddress.py
View file @
947ff387
...
@@ -587,8 +587,16 @@ class ComparisonTests(unittest.TestCase):
...
@@ -587,8 +587,16 @@ class ComparisonTests(unittest.TestCase):
v4_objects
=
v4_addresses
+
[
v4net
]
v4_objects
=
v4_addresses
+
[
v4net
]
v6_addresses
=
[
v6addr
,
v6intf
]
v6_addresses
=
[
v6addr
,
v6intf
]
v6_objects
=
v6_addresses
+
[
v6net
]
v6_objects
=
v6_addresses
+
[
v6net
]
objects
=
v4_objects
+
v6_objects
objects
=
v4_objects
+
v6_objects
v4addr2
=
ipaddress
.
IPv4Address
(
2
)
v4net2
=
ipaddress
.
IPv4Network
(
2
)
v4intf2
=
ipaddress
.
IPv4Interface
(
2
)
v6addr2
=
ipaddress
.
IPv6Address
(
2
)
v6net2
=
ipaddress
.
IPv6Network
(
2
)
v6intf2
=
ipaddress
.
IPv6Interface
(
2
)
def
test_foreign_type_equality
(
self
):
def
test_foreign_type_equality
(
self
):
# __eq__ should never raise TypeError directly
# __eq__ should never raise TypeError directly
other
=
object
()
other
=
object
()
...
@@ -607,6 +615,31 @@ class ComparisonTests(unittest.TestCase):
...
@@ -607,6 +615,31 @@ class ComparisonTests(unittest.TestCase):
continue
continue
self
.
assertNotEqual
(
lhs
,
rhs
)
self
.
assertNotEqual
(
lhs
,
rhs
)
def
test_same_type_equality
(
self
):
for
obj
in
self
.
objects
:
self
.
assertEqual
(
obj
,
obj
)
self
.
assertLessEqual
(
obj
,
obj
)
self
.
assertGreaterEqual
(
obj
,
obj
)
def
test_same_type_ordering
(
self
):
for
lhs
,
rhs
in
(
(
self
.
v4addr
,
self
.
v4addr2
),
(
self
.
v4net
,
self
.
v4net2
),
(
self
.
v4intf
,
self
.
v4intf2
),
(
self
.
v6addr
,
self
.
v6addr2
),
(
self
.
v6net
,
self
.
v6net2
),
(
self
.
v6intf
,
self
.
v6intf2
),
):
self
.
assertNotEqual
(
lhs
,
rhs
)
self
.
assertLess
(
lhs
,
rhs
)
self
.
assertLessEqual
(
lhs
,
rhs
)
self
.
assertGreater
(
rhs
,
lhs
)
self
.
assertGreaterEqual
(
rhs
,
lhs
)
self
.
assertFalse
(
lhs
>
rhs
)
self
.
assertFalse
(
rhs
<
lhs
)
self
.
assertFalse
(
lhs
>=
rhs
)
self
.
assertFalse
(
rhs
<=
lhs
)
def
test_containment
(
self
):
def
test_containment
(
self
):
for
obj
in
self
.
v4_addresses
:
for
obj
in
self
.
v4_addresses
:
self
.
assertIn
(
obj
,
self
.
v4net
)
self
.
assertIn
(
obj
,
self
.
v4net
)
...
...
Misc/ACKS
View file @
947ff387
...
@@ -102,6 +102,7 @@ Michael R Bax
...
@@ -102,6 +102,7 @@ Michael R Bax
Anthony Baxter
Anthony Baxter
Mike Bayer
Mike Bayer
Samuel L. Bayer
Samuel L. Bayer
Tommy Beadle
Donald Beaudry
Donald Beaudry
David Beazley
David Beazley
John Beck
John Beck
...
...
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