From ea44d86ed43349db25b6b2d8e4d4af2d5c618cf9 Mon Sep 17 00:00:00 2001 From: Mads Jensen Date: Sun, 22 Dec 2019 11:23:46 +0100 Subject: [PATCH] Added guidelines for assertIs() usage. --- docs/internals/contributing/writing-code/coding-style.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/internals/contributing/writing-code/coding-style.txt b/docs/internals/contributing/writing-code/coding-style.txt index f9952b3661..43db31501e 100644 --- a/docs/internals/contributing/writing-code/coding-style.txt +++ b/docs/internals/contributing/writing-code/coding-style.txt @@ -71,6 +71,11 @@ Python style and :meth:`~unittest.TestCase.assertWarnsRegex` only if you need regular expression matching. + Use :meth:`assertIs(…, True/False)` for testing + boolean values, rather than :meth:`~unittest.TestCase.assertTrue` and + :meth:`~unittest.TestCase.assertFalse`, so you can check the actual boolean + value, not the truthiness of the expression. + * In test docstrings, state the expected behavior that each test demonstrates. Don't include preambles such as "Tests that" or "Ensures that".