38
39
@symbol_versioning.deprecated_method(symbol_versioning.zero_seven)
39
40
def deprecated_method(self):
41
"""Deprecated method docstring.
43
This might explain stuff.
42
47
def test_deprecated_method(self):
43
48
expected_warning = (
44
49
"bzrlib.tests.test_symbol_versioning."
45
50
"TestDeprecationWarnings.deprecated_method "
46
"was deprecated in version 0.7", DeprecationWarning)
47
self.check_deprecated_callable(expected_warning,
51
"was deprecated in version 0.7.", DeprecationWarning)
52
expected_docstring = ('Deprecated method docstring.\n'
54
' This might explain stuff.\n'
56
' This method was deprecated in version 0.7.\n'
58
self.check_deprecated_callable(expected_warning, expected_docstring,
48
59
self.deprecated_method)
50
61
def test_deprecated_function(self):
51
62
expected_warning = (
52
63
"bzrlib.tests.test_symbol_versioning.deprecated_function "
53
"was deprecated in version 0.7", DeprecationWarning)
54
self.check_deprecated_callable(expected_warning,
64
"was deprecated in version 0.7.", DeprecationWarning)
65
expected_docstring = ('Deprecated function docstring.\n'
67
'This function was deprecated in version 0.7.\n'
69
self.check_deprecated_callable(expected_warning, expected_docstring,
55
70
deprecated_function)
57
def check_deprecated_callable(self, expected_warning, deprecated_callable):
72
def check_deprecated_callable(self, expected_warning, expected_docstring,
58
74
old_warning_method = symbol_versioning.warn
60
76
symbol_versioning.set_warning_method(self.capture_warning)
63
79
deprecated_callable()
64
80
self.assertEqual([expected_warning, expected_warning],
82
self.assertEqualDiff(expected_docstring, deprecated_callable.__doc__)
67
84
symbol_versioning.set_warning_method(old_warning_method)