diff options
author | Benjamin Peterson <benjamin@python.org> | 2015-01-02 09:29:09 -0600 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2015-01-02 09:29:09 -0600 |
commit | 532be7ae72888e7e8c5779d330a8abaa1d94254e (patch) | |
tree | 3e529d7c52765bfdf7f8a6f69caef0e8adc31e1d | |
parent | aeff5437821ca4b2a8aea2ccf0ef9adcd0bae302 (diff) | |
download | six-532be7ae72888e7e8c5779d330a8abaa1d94254e.tar.gz |
move unittest assertions section up
-rw-r--r-- | documentation/index.rst | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/documentation/index.rst b/documentation/index.rst index 25e5345..806504e 100644 --- a/documentation/index.rst +++ b/documentation/index.rst @@ -437,6 +437,39 @@ string data in all Python versions. :class:`py3:io.BytesIO`. +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. + + Renamed modules and attributes compatibility >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> @@ -746,39 +779,6 @@ 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 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |