Deprecate _BinaryMismatch.{expected,observed}

This commit is contained in:
Jonathan Lange
2015-12-21 19:45:07 +00:00
parent 331c6270da
commit c53e564cb1
2 changed files with 16 additions and 3 deletions

6
NEWS
View File

@@ -21,7 +21,11 @@ Changes
-------
* Add a new test dependency of testscenarios. (Robert Collins)
* Getting ``expected`` or ``observed`` attributes from binary comparison
mismatches (e.g. ``Equals(2).match(3).expected``) is now deprecated.
(Jonathan Lange)
1.8.1
~~~~~

View File

@@ -17,6 +17,7 @@ __all__ = [
import operator
from pprint import pformat
import re
import warnings
from ..compat import (
_isbytes,
@@ -75,12 +76,20 @@ class _BinaryMismatch(Mismatch):
@property
def expected(self):
# XXX: Deprecated.
warnings.warn(
'%s.expected deprecated after 1.8.1' % (self.__class__.__name__,),
DeprecationWarning,
stacklevel=2,
)
return self._reference
@property
def other(self):
# XXX: Deprecated.
warnings.warn(
'%s.other deprecated after 1.8.1' % (self.__class__.__name__,),
DeprecationWarning,
stacklevel=2,
)
return self._actual
def describe(self):