blob: d8c38761fffb8a41808bffcc24315f4c9696af24 (
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 unittest.mock 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)
|