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
0a27e3db
Commit
0a27e3db
authored
Jun 02, 2009
by
Gregory P. Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test code to verify that relative comparison operators with an object
of the wrong type fail properly (TypeError is raised).
parent
181bdc63
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
Lib/test/test_ipaddr.py
Lib/test/test_ipaddr.py
+10
-0
No files found.
Lib/test/test_ipaddr.py
View file @
0a27e3db
...
...
@@ -396,6 +396,16 @@ class IpaddrUnitTest(unittest.TestCase):
self
.
assertFalse
(
ip2
>
ip3
)
self
.
assertTrue
(
ip3
>
ip2
)
# Confirm that relative comparisons to the wrong type fail properly.
self
.
assertRaises
(
TypeError
,
lambda
:
ipv4
<
''
)
self
.
assertRaises
(
TypeError
,
lambda
:
ipv4
>
''
)
self
.
assertRaises
(
TypeError
,
lambda
:
ipv4
>=
''
)
self
.
assertRaises
(
TypeError
,
lambda
:
ipv4
<=
''
)
self
.
assertRaises
(
TypeError
,
lambda
:
ipv6
<
''
)
self
.
assertRaises
(
TypeError
,
lambda
:
ipv6
>
''
)
self
.
assertRaises
(
TypeError
,
lambda
:
ipv6
>=
''
)
self
.
assertRaises
(
TypeError
,
lambda
:
ipv6
<=
''
)
def
test_embedded_ipv4
(
self
):
ipv4_string
=
'192.168.0.1'
ipv4
=
ipaddr
.
IPv4
(
ipv4_string
)
...
...
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