You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by wf...@apache.org on 2015/04/15 02:06:19 UTC
aurora git commit: Implement missing != operator for AuroraJobKey
Repository: aurora
Updated Branches:
refs/heads/master 95f0d376f -> 51b29c5a5
Implement missing != operator for AuroraJobKey
Reviewed at https://reviews.apache.org/r/33184/
Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/51b29c5a
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/51b29c5a
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/51b29c5a
Branch: refs/heads/master
Commit: 51b29c5a50104081b63519897e3aef37a3380814
Parents: 95f0d37
Author: Stephan Erb <st...@dev.static-void.de>
Authored: Tue Apr 14 17:05:46 2015 -0700
Committer: Bill Farner <wf...@apache.org>
Committed: Tue Apr 14 17:05:46 2015 -0700
----------------------------------------------------------------------
.../python/apache/aurora/common/aurora_job_key.py | 3 +++
.../apache/aurora/common/test_aurora_job_key.py | 18 ++++++++++++++++++
2 files changed, 21 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/aurora/blob/51b29c5a/src/main/python/apache/aurora/common/aurora_job_key.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/common/aurora_job_key.py b/src/main/python/apache/aurora/common/aurora_job_key.py
index 88896c6..21cdca6 100644
--- a/src/main/python/apache/aurora/common/aurora_job_key.py
+++ b/src/main/python/apache/aurora/common/aurora_job_key.py
@@ -106,6 +106,9 @@ class AuroraJobKey(object):
return NotImplemented
return self.to_path() == other.to_path()
+ def __ne__(self, other):
+ return not (self == other)
+
def __lt__(self, other):
if not isinstance(other, AuroraJobKey):
return NotImplemented
http://git-wip-us.apache.org/repos/asf/aurora/blob/51b29c5a/src/test/python/apache/aurora/common/test_aurora_job_key.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/common/test_aurora_job_key.py b/src/test/python/apache/aurora/common/test_aurora_job_key.py
index 7d8d58b..59c52ac 100644
--- a/src/test/python/apache/aurora/common/test_aurora_job_key.py
+++ b/src/test/python/apache/aurora/common/test_aurora_job_key.py
@@ -21,3 +21,21 @@ from apache.aurora.common.aurora_job_key import AuroraJobKey
class AuroraJobKeyTest(unittest.TestCase):
def test_basic(self):
AuroraJobKey.from_path("smf1/mesos/test/labrat")
+
+ def test_equality(self):
+ key1 = AuroraJobKey('cluster', 'role', 'env', 'name')
+ key2 = AuroraJobKey('cluster', 'role', 'env', 'name')
+
+ assert key1 == key2
+ assert not (key1 != key2)
+
+ def test_inequality(self):
+ base = AuroraJobKey('cluster', 'role', 'env', 'name')
+ keys = [AuroraJobKey('XXXXXXX', 'role', 'env', 'name'),
+ AuroraJobKey('cluster', 'XXXX', 'env', 'name'),
+ AuroraJobKey('cluster', 'role', 'XXX', 'name'),
+ AuroraJobKey('cluster', 'role', 'env', 'XXXX')]
+
+ for key in keys:
+ assert base != key
+ assert not (base == key)