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
f9542174
Commit
f9542174
authored
Dec 24, 2010
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add direct tests for the util functions.
parent
1e7efdf2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
Lib/unittest/test/test_case.py
Lib/unittest/test/test_case.py
+13
-1
No files found.
Lib/unittest/test/test_case.py
View file @
f9542174
...
...
@@ -672,7 +672,7 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
else
:
self
.
fail
(
'assertMultiLineEqual did not fail'
)
def
test
a
ssertCountEqual
(
self
):
def
test
A
ssertCountEqual
(
self
):
a
=
object
()
self
.
assertCountEqual
([
1
,
2
,
3
],
[
3
,
2
,
1
])
self
.
assertCountEqual
([
'foo'
,
'bar'
,
'baz'
],
[
'bar'
,
'baz'
,
'foo'
])
...
...
@@ -721,6 +721,18 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
b
=
a
[::
-
1
]
self
.
assertCountEqual
(
a
,
b
)
# test utility functions supporting assertCountEqual()
diffs
=
set
(
unittest
.
util
.
_count_diff_all_purpose
(
'aaabccd'
,
'abbbcce'
))
expected
=
{(
3
,
1
,
'a'
),
(
1
,
3
,
'b'
),
(
1
,
0
,
'd'
),
(
0
,
1
,
'e'
)}
self
.
assertEqual
(
diffs
,
expected
)
diffs
=
unittest
.
util
.
_count_diff_all_purpose
([[]],
[])
self
.
assertEqual
(
diffs
,
[(
1
,
0
,
[])])
diffs
=
set
(
unittest
.
util
.
_count_diff_hashable
(
'aaabccd'
,
'abbbcce'
))
expected
=
{(
3
,
1
,
'a'
),
(
1
,
3
,
'b'
),
(
1
,
0
,
'd'
),
(
0
,
1
,
'e'
)}
self
.
assertEqual
(
diffs
,
expected
)
def
testAssertSetEqual
(
self
):
set1
=
set
()
...
...
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