mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #31327 -- Deprecated providing_args argument for Signal.
This commit is contained in:
committed by
Carlton Gibson
parent
5ca76baa72
commit
769cee5252
22
tests/signals/test_deprecation.py
Normal file
22
tests/signals/test_deprecation.py
Normal file
@@ -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)
|
||||
Reference in New Issue
Block a user