mirror of
https://github.com/django/django.git
synced 2025-08-31 07:47:37 +00:00
Completed django.dispatch test coverage.
This commit is contained in:
parent
66505b72c5
commit
c70ffeeb8b
2 changed files with 83 additions and 19 deletions
24
tests/dispatch/test_removedindjango20.py
Normal file
24
tests/dispatch/test_removedindjango20.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
import warnings
|
||||
|
||||
from django.dispatch import Signal
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
a_signal = Signal(providing_args=['val'])
|
||||
|
||||
|
||||
def receiver_1_arg(val, **kwargs):
|
||||
return val
|
||||
|
||||
|
||||
class DispatcherTests(SimpleTestCase):
|
||||
|
||||
def test_disconnect_weak_deprecated(self):
|
||||
a_signal.connect(receiver_1_arg)
|
||||
with warnings.catch_warnings(record=True) as warns:
|
||||
warnings.simplefilter('always')
|
||||
a_signal.disconnect(receiver_1_arg, weak=True)
|
||||
self.assertEqual(len(warns), 1)
|
||||
self.assertEqual(
|
||||
str(warns[0].message),
|
||||
'Passing `weak` to disconnect has no effect.',
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue