diff options
author | John L. Villalovos <john.l.villalovos@intel.com> | 2016-09-08 14:44:26 -0700 |
---|---|---|
committer | John L. Villalovos <john.l.villalovos@intel.com> | 2016-09-08 19:56:57 -0700 |
commit | aeaf273c07cf7dffbe2e6879ca247d0af557cd52 (patch) | |
tree | beb6ff97b36614213fe7e46b3d7a77176636d34d /ironic/api/controllers/base.py | |
parent | 41c0413adb6076d6c43a0de0b0b9be5d890551ef (diff) | |
download | ironic-aeaf273c07cf7dffbe2e6879ca247d0af557cd52.tar.gz |
__ne__() unit tests & have special methods use (self, other)
Commit 41c0413adb6076d6c43a0de0b0b9be5d890551ef added the __ne__()
method. This adds unit tests for the method.
Add some additional unit tests for the special methods.
Use the standard way[1] of defining the special methods __eq__() and
__gt__() with (self, other) as the arguments
https://docs.python.org/2/reference/datamodel.html#special-method-names
Change-Id: I947e7a453e1cb621f27a0bb3576b0544868734fb
Diffstat (limited to 'ironic/api/controllers/base.py')
-rw-r--r-- | ironic/api/controllers/base.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ironic/api/controllers/base.py b/ironic/api/controllers/base.py index 03aac3776..911f97d2c 100644 --- a/ironic/api/controllers/base.py +++ b/ironic/api/controllers/base.py @@ -105,11 +105,11 @@ class Version(object): "Invalid value for %s header") % Version.string) return version - def __gt__(a, b): - return (a.major, a.minor) > (b.major, b.minor) + def __gt__(self, other): + return (self.major, self.minor) > (other.major, other.minor) - def __eq__(a, b): - return (a.major, a.minor) == (b.major, b.minor) + def __eq__(self, other): + return (self.major, self.minor) == (other.major, other.minor) def __ne__(self, other): return not self.__eq__(other) |