summaryrefslogtreecommitdiff
path: root/docs/topics/testing/tools.txt
diff options
context:
space:
mode:
authorMorgan Aubert <morgan.aubert@impakfinance.com>2018-04-27 17:18:15 -0400
committerTim Graham <timograham@gmail.com>2018-05-09 11:40:28 -0400
commit704443acacf0dfbcb1c52df4b260585055754ce7 (patch)
tree600147bf6114d7b490fcd253ff9797b7e7531c09 /docs/topics/testing/tools.txt
parent7ba040de7703fd06b9b35ddd31da40103d911c30 (diff)
Fixed #29363 -- Added SimpleTestCase.assertWarnsMessage().
Diffstat (limited to 'docs/topics/testing/tools.txt')
-rw-r--r--docs/topics/testing/tools.txt11
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt
index ef818f1bb8..6e83bbc6a9 100644
--- a/docs/topics/testing/tools.txt
+++ b/docs/topics/testing/tools.txt
@@ -692,6 +692,8 @@ A subclass of :class:`unittest.TestCase` that adds this functionality:
* Checking that a callable :meth:`raises a certain exception
<SimpleTestCase.assertRaisesMessage>`.
+ * Checking that a callable :meth:`triggers a certain warning
+ <SimpleTestCase.assertWarnsMessage>`.
* Testing form field :meth:`rendering and error treatment
<SimpleTestCase.assertFieldOutput>`.
* Testing :meth:`HTML responses for the presence/lack of a given fragment
@@ -1362,6 +1364,15 @@ your test suite.
with self.assertRaisesMessage(ValueError, 'invalid literal for int()'):
int('a')
+.. method:: SimpleTestCase.assertWarnsMessage(expected_warning, expected_message, callable, *args, **kwargs)
+ SimpleTestCase.assertWarnsMessage(expected_warning, expected_message)
+
+ .. versionadded:: 2.1
+
+ Analogous to :meth:`SimpleTestCase.assertRaisesMessage` but for
+ :meth:`~unittest.TestCase.assertWarnsRegex` instead of
+ :meth:`~unittest.TestCase.assertRaisesRegex`.
+
.. method:: SimpleTestCase.assertFieldOutput(fieldclass, valid, invalid, field_args=None, field_kwargs=None, empty_value='')
Asserts that a form field behaves correctly with various inputs.