commit ee60b3aabe1fe7de3527c2a8a18f1769d2338b7e
Author: yuyafei <email address hidden>
Date: Sat Aug 13 15:42:08 2016 +0800
Add __ne__ built-in function
In Python 3 __ne__ by default delegates to __eq__ and inverts the
result, but in Python 2 they urge you to define __ne__ when you
define __eq__ for it to work properly [1].There are no implied
relationships among the comparison operators. The truth of x==y
does not imply that x!=y is false. Accordingly, when defining
__eq__(), one should also define __ne__() so that the operators
will behave as expected.
[1]https://docs.python.org/2/reference/datamodel.html#object.__ne__
Without the change in base.py, if r1==r2, the follow code should all
pass. self.assertEqual(r1, r2) self.assertNotEqual(r1, r2)
The change here is for a way to self.assertNotEqual(r1, r2) as
expected.
Reviewed: https:/ /review. openstack. org/355157 /git.openstack. org/cgit/ openstack/ python- manilaclient/ commit/ ?id=ee60b3aabe1 fe7de3527c2a8a1 8f1769d2338b7e
Committed: https:/
Submitter: Jenkins
Branch: master
commit ee60b3aabe1fe7d e3527c2a8a18f17 69d2338b7e
Author: yuyafei <email address hidden>
Date: Sat Aug 13 15:42:08 2016 +0800
Add __ne__ built-in function
In Python 3 __ne__ by default delegates to __eq__ and inverts the /docs.python. org/2/reference /datamodel. html#object. __ne__
result, but in Python 2 they urge you to define __ne__ when you
define __eq__ for it to work properly [1].There are no implied
relationships among the comparison operators. The truth of x==y
does not imply that x!=y is false. Accordingly, when defining
__eq__(), one should also define __ne__() so that the operators
will behave as expected.
[1]https:/
Without the change in base.py, if r1==r2, the follow code should all
self.assertEqu al(r1, r2)
self.assertNot Equal(r1, r2) qual(r1, r2) as
pass.
The change here is for a way to self.assertNotE
expected.
Change-Id: I72485d38eab8b5 a2034a621e1eebf 33b86832f35
Closes-Bug: #1586268