aboutsummaryrefslogtreecommitdiff
path: root/tests/test_pandora/test_util.py
blob: 2b4ca835c2f1db9f54c8b64378653fbe03877083 (plain)
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 unittest import TestCase
from pandora.py2compat import patch

from pandora import util


class TestDeprecatedWarning(TestCase):

    def test_warning(self):
        class Bar(object):

            @util.deprecated("1.0", "2.0", "Don't use this")
            def foo(self):
                pass

        with patch.object(warnings, "warn") as wmod:
            Bar().foo()

            wmod.assert_called_with(
                ("foo is deprecated as of version 1.0 and will be removed in "
                    "version 2.0. Don't use this"), DeprecationWarning)