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
9788e860
Commit
9788e860
authored
Nov 17, 2013
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #19594: Use specific asserts in unittest tests.
parent
52bbeacb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
9 deletions
+9
-9
Lib/unittest/test/test_case.py
Lib/unittest/test/test_case.py
+6
-6
Lib/unittest/test/test_loader.py
Lib/unittest/test/test_loader.py
+1
-1
Lib/unittest/test/test_result.py
Lib/unittest/test/test_result.py
+2
-2
No files found.
Lib/unittest/test/test_case.py
View file @
9788e860
...
...
@@ -293,7 +293,7 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
def
test
(
self
):
pass
self
.
assert
True
(
Foo
(
'test'
).
failureException
is
AssertionError
)
self
.
assert
Is
(
Foo
(
'test'
).
failureException
,
AssertionError
)
# "This class attribute gives the exception raised by the test() method.
# If a test framework needs to use a specialized exception, possibly to
...
...
@@ -311,7 +311,7 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
failureException
=
RuntimeError
self
.
assert
True
(
Foo
(
'test'
).
failureException
is
RuntimeError
)
self
.
assert
Is
(
Foo
(
'test'
).
failureException
,
RuntimeError
)
Foo
(
'test'
).
run
(
result
)
...
...
@@ -334,7 +334,7 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
failureException
=
RuntimeError
self
.
assert
True
(
Foo
(
'test'
).
failureException
is
RuntimeError
)
self
.
assert
Is
(
Foo
(
'test'
).
failureException
,
RuntimeError
)
Foo
(
'test'
).
run
(
result
)
...
...
@@ -607,7 +607,7 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
msg
=
e
.
args
[
0
]
else
:
self
.
fail
(
'assertSequenceEqual did not fail.'
)
self
.
assert
True
(
len
(
msg
)
<
len
(
diff
))
self
.
assert
Less
(
len
(
msg
),
len
(
diff
))
self
.
assertIn
(
omitted
,
msg
)
self
.
maxDiff
=
len
(
diff
)
*
2
...
...
@@ -617,7 +617,7 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
msg
=
e
.
args
[
0
]
else
:
self
.
fail
(
'assertSequenceEqual did not fail.'
)
self
.
assert
True
(
len
(
msg
)
>
len
(
diff
))
self
.
assert
Greater
(
len
(
msg
),
len
(
diff
))
self
.
assertNotIn
(
omitted
,
msg
)
self
.
maxDiff
=
None
...
...
@@ -627,7 +627,7 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
msg
=
e
.
args
[
0
]
else
:
self
.
fail
(
'assertSequenceEqual did not fail.'
)
self
.
assert
True
(
len
(
msg
)
>
len
(
diff
))
self
.
assert
Greater
(
len
(
msg
),
len
(
diff
))
self
.
assertNotIn
(
omitted
,
msg
)
def
testTruncateMessage
(
self
):
...
...
Lib/unittest/test/test_loader.py
View file @
9788e860
...
...
@@ -1279,7 +1279,7 @@ class Test_TestLoader(unittest.TestCase):
# "The default value is the TestSuite class"
def
test_suiteClass__default_value
(
self
):
loader
=
unittest
.
TestLoader
()
self
.
assert
True
(
loader
.
suiteClass
is
unittest
.
TestSuite
)
self
.
assert
Is
(
loader
.
suiteClass
,
unittest
.
TestSuite
)
# Make sure the dotted name resolution works even if the actual
# function doesn't have the same name as is used to find it.
...
...
Lib/unittest/test/test_result.py
View file @
9788e860
...
...
@@ -176,7 +176,7 @@ class Test_TestResult(unittest.TestCase):
self
.
assertEqual
(
result
.
shouldStop
,
False
)
test_case
,
formatted_exc
=
result
.
failures
[
0
]
self
.
assert
True
(
test_case
is
test
)
self
.
assert
Is
(
test_case
,
test
)
self
.
assertIsInstance
(
formatted_exc
,
str
)
# "addError(test, err)"
...
...
@@ -224,7 +224,7 @@ class Test_TestResult(unittest.TestCase):
self
.
assertEqual
(
result
.
shouldStop
,
False
)
test_case
,
formatted_exc
=
result
.
errors
[
0
]
self
.
assert
True
(
test_case
is
test
)
self
.
assert
Is
(
test_case
,
test
)
self
.
assertIsInstance
(
formatted_exc
,
str
)
def
testGetDescriptionWithoutDocstring
(
self
):
...
...
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