Anonymous avatar Anonymous committed b8eed7a

Update the unittest section.

Comments (0)

Files changed (1)

Doc/whatsnew/3.2.rst

   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::
+* The command call, ``python -m unittest`` can now accept file paths instead
+  of module names for running specific tests (:issue:`10620`).
 
-      with self.assertWarns(DeprecationWarning):
-          legacy_function('XYZ')
+* 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:
 
-* 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);
+  >>> with self.assertWarns(DeprecationWarning):
+  ...     legacy_function('XYZ')
 
-  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.
+  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`.)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.