diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2020-03-01 09:22:03 -0800 |
|---|---|---|
| committer | Carlton Gibson <carlton@noumenal.es> | 2020-03-05 09:38:52 +0100 |
| commit | 769cee525222bb155735aba31d6174d73c271f3c (patch) | |
| tree | eeaee53a694669e78a63c9da96da93db1ca0c9b8 /tests | |
| parent | 5ca76baa729bbbe62f5c4a0fc4f89747dc999029 (diff) | |
Fixed #31327 -- Deprecated providing_args argument for Signal.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/dispatch/tests.py | 8 | ||||
| -rw-r--r-- | tests/signals/test_deprecation.py | 22 |
2 files changed, 26 insertions, 4 deletions
diff --git a/tests/dispatch/tests.py b/tests/dispatch/tests.py index 2377dcff8a..9b5482ed58 100644 --- a/tests/dispatch/tests.py +++ b/tests/dispatch/tests.py @@ -29,10 +29,10 @@ class Callable: return val -a_signal = Signal(providing_args=["val"]) -b_signal = Signal(providing_args=["val"]) -c_signal = Signal(providing_args=["val"]) -d_signal = Signal(providing_args=["val"], use_caching=True) +a_signal = Signal() +b_signal = Signal() +c_signal = Signal() +d_signal = Signal(use_caching=True) class DispatcherTests(SimpleTestCase): diff --git a/tests/signals/test_deprecation.py b/tests/signals/test_deprecation.py new file mode 100644 index 0000000000..b961dafd8a --- /dev/null +++ b/tests/signals/test_deprecation.py @@ -0,0 +1,22 @@ +import warnings + +from django.dispatch import Signal +from django.test import SimpleTestCase +from django.utils.deprecation import RemovedInDjango40Warning + + +class SignalDeprecationTests(SimpleTestCase): + def test_providing_args_warning(self): + msg = ( + 'The providing_args argument is deprecated. As it is purely ' + 'documentational, it has no replacement. If you rely on this ' + 'argument as documentation, you can move the text to a code ' + 'comment or docstring.' + ) + with self.assertWarnsMessage(RemovedInDjango40Warning, msg): + Signal(providing_args=['arg1', 'arg2']) + + def test_without_providing_args_does_not_warn(self): + with warnings.catch_warnings(record=True) as recorded: + Signal() + self.assertEqual(len(recorded), 0) |
