diff options
author | Tim Graham <timograham@gmail.com> | 2014-11-25 18:22:19 -0500 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2014-11-25 18:22:19 -0500 |
commit | 8f481c478b9aac37a907eeb58b5e0804a7f4d1a0 (patch) | |
tree | 6fe7d231bdb2e40b44671a101a79725cfc6ce2e2 /documentation/index.rst | |
parent | d7c4f2ed2847c1472c0e60f20e25db20e60dc7d7 (diff) | |
download | six-git-8f481c478b9aac37a907eeb58b5e0804a7f4d1a0.tar.gz |
Added unittest aliases.
Diffstat (limited to 'documentation/index.rst')
-rw-r--r-- | documentation/index.rst | 33 |
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 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |