File: test_deprecation.py

package info (click to toggle)
python-django 3%3A3.2.19-1%2Bdeb12u2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 56,696 kB
  • sloc: python: 264,418; javascript: 18,362; xml: 193; makefile: 178; sh: 43
file content (22 lines) | stat: -rw-r--r-- 835 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)