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
77902970
Commit
77902970
authored
Dec 29, 2001
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test_support: add a docstring to vereq().
test_complex: repair new test's usage of vereq().
parent
5a0f010c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
Lib/test/test_complex.py
Lib/test/test_complex.py
+1
-2
Lib/test/test_support.py
Lib/test/test_support.py
+10
-0
No files found.
Lib/test/test_complex.py
View file @
77902970
...
@@ -63,8 +63,7 @@ for i in range(100):
...
@@ -63,8 +63,7 @@ for i in range(100):
if
complex
(
0.0
,
0.0
):
if
complex
(
0.0
,
0.0
):
raise
TestFailed
(
"complex(0.0, 0.0) should be false"
)
raise
TestFailed
(
"complex(0.0, 0.0) should be false"
)
if
vereq
(
complex
(
5.3
,
9.8
).
conjugate
(),
5.3
-
9.8j
):
vereq
(
complex
(
5.3
,
9.8
).
conjugate
(),
5.3
-
9.8j
)
raise
TestFailed
(
"complex.conjugate() didn't work"
)
try
:
try
:
print
int
(
5
+
3j
)
print
int
(
5
+
3j
)
...
...
Lib/test/test_support.py
View file @
77902970
...
@@ -118,6 +118,16 @@ def verify(condition, reason='test failed'):
...
@@ -118,6 +118,16 @@ def verify(condition, reason='test failed'):
raise
TestFailed
(
reason
)
raise
TestFailed
(
reason
)
def
vereq
(
a
,
b
):
def
vereq
(
a
,
b
):
"""Raise TestFailed if a == b is false.
This is better than verify(a == b) because, in case of failure, the
error message incorporates repr(a) and repr(b) so you can see the
inputs.
Note that "not (a == b)" isn't necessarily the same as "a != b"; the
former is tested.
"""
if
not
(
a
==
b
):
if
not
(
a
==
b
):
raise
TestFailed
,
"%r == %r"
%
(
a
,
b
)
raise
TestFailed
,
"%r == %r"
%
(
a
,
b
)
...
...
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