From 532be7ae72888e7e8c5779d330a8abaa1d94254e Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Fri, 2 Jan 2015 09:29:09 -0600 Subject: move unittest assertions section up --- documentation/index.rst | 66 ++++++++++++++++++++++++------------------------- 1 file 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 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -- cgit v1.2.1