@@ -835,7 +835,7 @@ Test cases
835835 +-----------------------------------------+-----------------------------+---------------+
836836
837837 All the assert methods (except :meth: `assertRaises `,
838- :meth: `assertRaisesRegexp `, :meth: `assertWarns `, :meth: `assertWarnsRegexp `)
838+ :meth: `assertRaisesRegex `, :meth: `assertWarns `, :meth: `assertWarnsRegex `)
839839 accept a *msg * argument that, if specified, is used as the error message on
840840 failure (see also :data: `longMessage `).
841841
@@ -919,14 +919,14 @@ Test cases
919919 | :meth: `assertRaises(exc, fun, *args, **kwds) | ``fun(*args, **kwds) `` raises `exc ` | |
920920 | <TestCase.assertRaises>` | | |
921921 +---------------------------------------------------------+--------------------------------------+------------+
922- | :meth: `assertRaisesRegexp (exc, re, fun, *args, **kwds) | ``fun(*args, **kwds) `` raises `exc ` | 3.1 |
923- | <TestCase.assertRaisesRegexp>` | and the message matches `re ` | |
922+ | :meth: `assertRaisesRegex (exc, re, fun, *args, **kwds) | ``fun(*args, **kwds) `` raises `exc ` | 3.1 |
923+ | <TestCase.assertRaisesRegex>` | and the message matches `re ` | |
924924 +---------------------------------------------------------+--------------------------------------+------------+
925925 | :meth: `assertWarns(warn, fun, *args, **kwds) | ``fun(*args, **kwds) `` raises `warn ` | 3.2 |
926926 | <TestCase.assertWarns>` | | |
927927 +---------------------------------------------------------+--------------------------------------+------------+
928- | :meth: `assertWarnsRegexp (warn, re, fun, *args, **kwds) | ``fun(*args, **kwds) `` raises `warn ` | 3.2 |
929- | <TestCase.assertWarnsRegexp>` | and the message matches `re ` | |
928+ | :meth: `assertWarnsRegex (warn, re, fun, *args, **kwds) | ``fun(*args, **kwds) `` raises `warn ` | 3.2 |
929+ | <TestCase.assertWarnsRegex>` | and the message matches `re ` | |
930930 +---------------------------------------------------------+--------------------------------------+------------+
931931
932932 .. method :: assertRaises(exception, callable, *args, **kwds)
@@ -962,23 +962,25 @@ Test cases
962962 Added the :attr: `exception ` attribute.
963963
964964
965- .. method :: assertRaisesRegexp (exception, regexp , callable, *args, **kwds)
966- assertRaisesRegexp (exception, regexp )
965+ .. method :: assertRaisesRegex (exception, regex , callable, *args, **kwds)
966+ assertRaisesRegex (exception, regex )
967967
968- Like :meth: `assertRaises ` but also tests that *regexp * matches
969- on the string representation of the raised exception. *regexp * may be
968+ Like :meth: `assertRaises ` but also tests that *regex * matches
969+ on the string representation of the raised exception. *regex * may be
970970 a regular expression object or a string containing a regular expression
971971 suitable for use by :func: `re.search `. Examples::
972972
973- self.assertRaisesRegexp (ValueError, 'invalid literal for.*XYZ$',
974- int, 'XYZ')
973+ self.assertRaisesRegex (ValueError, 'invalid literal for.*XYZ$',
974+ int, 'XYZ')
975975
976976 or::
977977
978- with self.assertRaisesRegexp (ValueError, 'literal'):
978+ with self.assertRaisesRegex (ValueError, 'literal'):
979979 int('XYZ')
980980
981- .. versionadded :: 3.1
981+ .. versionadded :: 3.1 ``assertRaisesRegexp``
982+ .. versionchanged :: 3.2
983+ The method has been renamed to :meth: `assertRaisesRegex `
982984
983985
984986 .. method :: assertWarns(warning, callable, *args, **kwds)
@@ -1015,21 +1017,21 @@ Test cases
10151017 .. versionadded :: 3.2
10161018
10171019
1018- .. method :: assertWarnsRegexp (warning, regexp , callable, *args, **kwds)
1019- assertWarnsRegexp (warning, regexp )
1020+ .. method :: assertWarnsRegex (warning, regex , callable, *args, **kwds)
1021+ assertWarnsRegex (warning, regex )
10201022
1021- Like :meth: `assertWarns ` but also tests that *regexp * matches on the
1022- message of the triggered warning. *regexp * may be a regular expression
1023+ Like :meth: `assertWarns ` but also tests that *regex * matches on the
1024+ message of the triggered warning. *regex * may be a regular expression
10231025 object or a string containing a regular expression suitable for use
10241026 by :func: `re.search `. Example::
10251027
1026- self.assertWarnsRegexp (DeprecationWarning,
1027- r'legacy_function\(\) is deprecated',
1028- legacy_function, 'XYZ')
1028+ self.assertWarnsRegex (DeprecationWarning,
1029+ r'legacy_function\(\) is deprecated',
1030+ legacy_function, 'XYZ')
10291031
10301032 or::
10311033
1032- with self.assertWarnsRegexp (RuntimeWarning, 'unsafe frobnicating'):
1034+ with self.assertWarnsRegex (RuntimeWarning, 'unsafe frobnicating'):
10331035 frobnicate('/etc/passwd')
10341036
10351037 .. versionadded :: 3.2
@@ -1059,11 +1061,11 @@ Test cases
10591061 | :meth: `assertLessEqual(a, b) | ``a <= b `` | 3.1 |
10601062 | <TestCase.assertLessEqual>` | | |
10611063 +---------------------------------------+--------------------------------+--------------+
1062- | :meth: `assertRegexpMatches (s, re) | ``regex.search(s) `` | 3.1 |
1063- | <TestCase.assertRegexpMatches>` | | |
1064+ | :meth: `assertRegex (s, re) | ``regex.search(s) `` | 3.1 |
1065+ | <TestCase.assertRegex>` | | |
10641066 +---------------------------------------+--------------------------------+--------------+
1065- | :meth: `assertNotRegexpMatches (s, re) | ``not regex.search(s) `` | 3.2 |
1066- | <TestCase.assertNotRegexpMatches>` | | |
1067+ | :meth: `assertNotRegex (s, re) | ``not regex.search(s) `` | 3.2 |
1068+ | <TestCase.assertNotRegex>` | | |
10671069 +---------------------------------------+--------------------------------+--------------+
10681070 | :meth: `assertDictContainsSubset(a, b) | all the key/value pairs | 3.1 |
10691071 | <TestCase.assertDictContainsSubset>` | in `a ` exist in `b ` | |
@@ -1108,17 +1110,19 @@ Test cases
11081110 .. versionadded :: 3.1
11091111
11101112
1111- .. method :: assertRegexpMatches (text, regexp , msg=None)
1112- assertNotRegexpMatches (text, regexp , msg=None)
1113+ .. method :: assertRegex (text, regex , msg=None)
1114+ assertNotRegex (text, regex , msg=None)
11131115
1114- Test that a *regexp * search matches (or does not match) *text *. In case
1116+ Test that a *regex * search matches (or does not match) *text *. In case
11151117 of failure, the error message will include the pattern and the *text * (or
1116- the pattern and the part of *text * that unexpectedly matched). *regexp *
1118+ the pattern and the part of *text * that unexpectedly matched). *regex *
11171119 may be a regular expression object or a string containing a regular
11181120 expression suitable for use by :func: `re.search `.
11191121
1120- .. versionadded :: 3.1 :meth:`~TestCase.assertRegexpMatches`
1121- .. versionadded :: 3.2 :meth:`~TestCase.assertNotRegexpMatches`
1122+ .. versionadded :: 3.1 ``.assertRegexpMatches``
1123+ .. versionchanged :: 3.2
1124+ ``.assertRegexpMatches `` has been renamed to :meth: `.assertRegex `
1125+ .. versionadded :: 3.2 :meth:`.assertNotRegex`
11221126
11231127
11241128 .. method :: assertDictContainsSubset(expected, actual, msg=None)
@@ -1420,13 +1424,17 @@ along with their deprecated aliases:
14201424 :meth: `.assertRaises ` failUnlessRaises
14211425 :meth: `.assertAlmostEqual ` failUnlessAlmostEqual assertAlmostEquals
14221426 :meth: `.assertNotAlmostEqual ` failIfAlmostEqual assertNotAlmostEquals
1427+ :meth: `.assertRegex ` assertRegexpMatches
1428+ :meth: `.assertRaisesRegex ` assertRaisesRegexp
14231429 ============================== ====================== ======================
14241430
14251431 .. deprecated-removed :: 3.1 3.3
14261432 the fail* aliases listed in the second column.
14271433 .. deprecated :: 3.2
14281434 the assert* aliases listed in the third column.
1429-
1435+ .. deprecated :: 3.2
1436+ ``assertRegexpMatches `` and ``assertRaisesRegexp `` have been renamed to
1437+ :meth: `.assertRegex ` and :meth: `.assertRaisesRegex `
14301438
14311439
14321440.. _testsuite-objects :
0 commit comments