Merge "Add __ne__ built-in function"
This commit is contained in:
commit
f387043138
@ -125,6 +125,12 @@ class Opt(object):
|
||||
self.default == other.default and
|
||||
self.metavar == other.metavar)
|
||||
|
||||
# NOTE: This function is only needed by Python 2. If we get to point where
|
||||
# we don't support Python 2 anymore, this function should be removed.
|
||||
def __ne__(self, other):
|
||||
"""Define inequality operator on option parameters."""
|
||||
return not self.__eq__(other)
|
||||
|
||||
@property
|
||||
def _all_opts(self):
|
||||
return itertools.chain([self], self.deprecated)
|
||||
|
@ -75,6 +75,12 @@ class BoolType(object):
|
||||
# hack around oslo.config equality comparison
|
||||
return type(self) == type(other)
|
||||
|
||||
# NOTE: This function is only needed by Python 2. If we get to point where
|
||||
# we don't support Python 2 anymore, this function should be removed.
|
||||
def __ne__(self, other):
|
||||
"""Define inequiality for many bool types."""
|
||||
return not self.__eq__(other)
|
||||
|
||||
def __call__(self, value):
|
||||
return str(value).lower() in ('1', 'true', 't', 'yes', 'y')
|
||||
|
||||
|
@ -134,6 +134,12 @@ class TestResponse(requests.Response):
|
||||
"""Define equiality behavior of request and response."""
|
||||
return self.__dict__ == other.__dict__
|
||||
|
||||
# NOTE: This function is only needed by Python 2. If we get to point where
|
||||
# we don't support Python 2 anymore, this function should be removed.
|
||||
def __ne__(self, other):
|
||||
"""Define inequiality behavior of request and response."""
|
||||
return not self.__eq__(other)
|
||||
|
||||
@property
|
||||
def text(self):
|
||||
return self.content
|
||||
|
Loading…
x
Reference in New Issue
Block a user