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
ed381e0c
Commit
ed381e0c
authored
Jan 03, 2014
by
R David Murray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
whatsnew: Mock mock_open readline(s); expand description of subtests feature.
parent
d95f5a90
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
5 deletions
+23
-5
Doc/whatsnew/3.4.rst
Doc/whatsnew/3.4.rst
+23
-5
No files found.
Doc/whatsnew/3.4.rst
View file @
ed381e0c
...
...
@@ -759,6 +759,9 @@ matching calls, which means an argument can now be matched by either position
or name, instead of only by position. (Contributed by Antoine Pitrou in
:issue:`17015`.)
:func:`~mock.mock_open` objects now have ``readline`` and ``readlines``
methods. (Contributed by Toshio Kuratomi in :issue:`17467`.)
multiprocessing
---------------
...
...
@@ -1010,11 +1013,26 @@ in :issue:`16423`.)
unittest
--------
Support for easy dynamically-generated subtests using the
:meth:`~unittest.TestCase.subTest` context manager.
(Contributed by Antoine Pitrou in :issue:`16997`.)
:func:`unittest.main` now also accepts an iterable of test names for
The :class:`~unittest.TestCase` class has a new method,
:meth:`~unittest.TestCase.subTest`, that produces a context manager whose
:keyword:`with` block becomes a "sub-test". This context manager allows a test
method to dynamically generate subtests by, say, calling the ``subTest``
context manager inside a loop. A single test method can thereby produce an
indefinite number of separately-identified and separately-counted tests, all of
which will run even if one or more of them fail. For example::
class NumbersTest(unittest.TestCase):
def test_even(self):
for i in range(6):
with self.subTest(i=1):
self.assertEqual(i % 2, 0)
will result in six subtests, each identified in the unittest verbose output
with a label consisting of the variable name ``i`` and a particular value for
that variable (``i=0``, ``i=1``, etc). See :ref:`subtests` for the full
version of this example. (Contributed by Antoine Pitrou in :issue:`16997`.)
:func:`unittest.main` now accepts an iterable of test names for
*defaultTest*, where previously it only accepted a single test name as a
string. (Contributed by Jyrki Pulliainen in :issue:`15132`.)
...
...
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