diff --git a/HACKING.rst b/HACKING.rst index 3f2aba90..14eaa609 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -311,6 +311,18 @@ exception possible should be used. ``assertIsNotNone(...)`` is preferred over ``assertNotEqual(None, ...)`` and ``assertIsNot(None, ...)``. Off by default. +- [H204] Use assert(Not)Equal to check for equality. + Unit test assertions tend to give better messages for more specific + assertions. As a result, ``assertEqual(...)`` is preferred over + ``assertTrue(... == ...)``, and ``assertNotEqual(...)`` is preferred over + ``assertFalse(... == ...)``. Off by default. + +- [H205] Use assert(Greater|Less)(Equal) for comparison. + Unit test assertions tend to give better messages for more specific + assertions. As a result, ``assertGreater(Equal)(...)`` is preferred over + ``assertTrue(... >(=) ...)``, and ``assertLess(Equal)(...)`` is preferred over + ``assertTrue(... <(=) ...)``. Off by default. + - [H210] Require ``autospec``, ``spec``, or ``spec_set`` in ``mock.patch()`` or ``mock.patch.object()`` calls (off by default) diff --git a/README.rst b/README.rst index 2744fa90..bbd20be1 100644 --- a/README.rst +++ b/README.rst @@ -95,6 +95,8 @@ Some of the available checks are disabled by default. These checks are: - [H106] Don't put vim configuration in source files. - [H203] Use assertIs(Not)None to check for None. +- [H204] Use assert(Not)Equal to check for equality. +- [H205] Use assert(Greater|Less)(Equal) for comparison. - [H210] Require 'autospec', 'spec', or 'spec_set' in mock.patch/mock.patch.object calls - [H904] Delay string interpolations at logging calls. diff --git a/releasenotes/notes/start-of-queens-c3024ebbb49aef6f.yaml b/releasenotes/notes/start-of-queens-c3024ebbb49aef6f.yaml new file mode 100644 index 00000000..e040684d --- /dev/null +++ b/releasenotes/notes/start-of-queens-c3024ebbb49aef6f.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + This release includes a new check, disabled by default. + [H210] Require 'autospec', 'spec', or 'spec_set' in + mock.patch/mock.patch.object calls + [H204] Use assert(Not)Equal to check for equality. + [H205] Use assert(Greater|Less)(Equal) for comparison.