summaryrefslogtreecommitdiff
path: root/documentation/index.rst
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/index.rst')
-rw-r--r--documentation/index.rst33
1 files changed, 33 insertions, 0 deletions
diff --git a/documentation/index.rst b/documentation/index.rst
index 7851421..6b3ad1e 100644
--- a/documentation/index.rst
+++ b/documentation/index.rst
@@ -746,6 +746,39 @@ Contains classes from Python 3's :mod:`py3:urllib.response` and Python 2's:
* :class:`py2:urllib.addinfourl`
+unittest assertions
+<<<<<<<<<<<<<<<<<<<
+
+.. currentmodule:: six
+
+Contains compatibility shims for unittest assertions that have been renamed.
+The parameters are the same as their aliases, but you must pass the test method
+as the first argument. For example::
+
+ import six
+ import unittest
+
+ class TestAssertCountEqual(unittest.TestCase):
+ def test(self):
+ six.assertCountEqual(self, (1, 2), [2, 1])
+
+
+.. function:: assertCountEqual()
+
+ Alias for :meth:`~py3:unittest.TestCase.assertCountEqual` on Python 3 and
+ :meth:`~py2:unittest.TestCase.assertItemsEqual` on Python 2.
+
+.. function:: assertRaisesRegex()
+
+ Alias for :meth:`~py3:unittest.TestCase.assertRaisesRegex` on Python 3 and
+ :meth:`~py2:unittest.TestCase.assertRaisesRegexp` on Python 2.
+
+.. function:: assertRegex()
+
+ Alias for :meth:`~py3:unittest.TestCase.assertRegex` on Python 3 and
+ :meth:`~py2:unittest.TestCase.assertRegexpMatches` on Python 2.
+
+
Advanced - Customizing renames
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<