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
dc2f9b5c
Commit
dc2f9b5c
authored
Dec 05, 2010
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the unittest section.
parent
7d819751
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
17 deletions
+27
-17
Doc/whatsnew/3.2.rst
Doc/whatsnew/3.2.rst
+27
-17
No files found.
Doc/whatsnew/3.2.rst
View file @
dc2f9b5c
...
...
@@ -651,23 +651,33 @@ New, Improved, and Deprecated Modules
as recommended in public uses of HTTPS.
(Added by Antoine Pitrou, :issue:`9003`.)
* Instances of :class:`unittest.TestCase` have two new methods
:meth:`~unittest.TestCase.assertWarns` and :meth:`~unittest.TestCase.assertWarnsRegexp`
to check that a given warning type was triggered by the code under test::
with self.assertWarns(DeprecationWarning):
legacy_function('XYZ')
* The following :class:`unittest.TestCase` methods are now deprecated:
* :meth:`assert_` (use :meth:`.assertTrue` instead);
* :meth:`assertEquals` (use :meth:`.assertEqual` instead);
* :meth:`assertNotEquals` (use :meth:`.assertNotEqual` instead);
* :meth:`assertAlmostEquals` (use :meth:`.assertAlmostEqual` instead);
* :meth:`assertNotAlmostEquals` (use :meth:`.assertNotAlmostEqual` instead);
The ``TestCase.fail*`` methods deprecated in Python 3.1 will be removed in
Python 3.3. See also the :ref:`deprecated-aliases` section in the
:mod:`unittest` documentation.
* The command call, ``python -m unittest`` can now accept file paths instead
of module names for running specific tests (:issue:`10620`).
* The :mod:`unittest` module has two new methods,
:meth:`~unittest.TestCase.assertWarns` and
:meth:`~unittest.TestCase.assertWarnsRegex` to check that a given warning type
was triggered by the code under test:
>>> with self.assertWarns(DeprecationWarning):
... legacy_function('XYZ')
In addition, the naming in the module has ungone a number of clean-ups.
For example, :meth:`assertRegex` is the new name for :meth:`assertRegexpMatches`
which was misnamed because the test uses :func:`re.search`, not :func:`re.match`.
To improve consistency, some of long-standing method aliases are being
deprecated in favor of the preferred names:
- replace :meth:`assert_` with :meth:`.assertTrue`
- replace :meth:`assertEquals` with :meth:`.assertEqual`
- replace :meth:`assertNotEquals` with :meth:`.assertNotEqual`
- replace :meth:`assertAlmostEquals` with :meth:`.assertAlmostEqual`
- replace :meth:`assertNotAlmostEquals` with :meth:`.assertNotAlmostEqual`
Likewise, the ``TestCase.fail*`` methods deprecated in Python 3.1 are expected
to be removed in Python 3.3. See also the :ref:`deprecated-aliases` section in
the :mod:`unittest` documentation.
(Contributed by Ezio Melotti; :issue:`9424`.)
...
...
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