diff options
author | Alexander Shorin <kxepal@apache.org> | 2013-10-28 06:30:05 +0400 |
---|---|---|
committer | Alexander Shorin <kxepal@apache.org> | 2013-10-28 06:30:05 +0400 |
commit | 3206a73fccb68f9d615b297d6c515848272efc53 (patch) | |
tree | 58c657227d6f2008a748528b9b722af4fdbc3e4f | |
parent | 89caf5548dd77b7db8d68194c7c43277172ebec8 (diff) | |
download | python-json-patch-3206a73fccb68f9d615b297d6c515848272efc53.tar.gz |
Fix broken test for Python 2.x
Fun fact: for Python 3.x you don't need to explicitly implement __ne__
method if __eq__ exists, but you have do this for 2.x or your objects
may be equal and non-equal at the same time. Seems like, before
refactoring, operator.eq had used right logic.
-rw-r--r-- | jsonpatch.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/jsonpatch.py b/jsonpatch.py index 48f27e5..926c729 100644 --- a/jsonpatch.py +++ b/jsonpatch.py @@ -248,6 +248,9 @@ class JsonPatch(object): return False return True + def __ne__(self, other): + return not(self == other) + @classmethod def from_string(cls, patch_str): """Creates JsonPatch instance from string source. @@ -391,6 +394,9 @@ class PatchOperation(object): return False return self.operation == other.operation + def __ne__(self, other): + return not(self == other) + class RemoveOperation(PatchOperation): """Removes an object property or an array element.""" |