summaryrefslogtreecommitdiff
path: root/gear/__init__.py
diff options
context:
space:
mode:
authorJames E. Blair <jeblair@hp.com>2014-12-18 13:49:22 -0800
committerJames E. Blair <jeblair@hp.com>2014-12-18 14:04:17 -0800
commit178eae1dcf43db3647d18e7f5fe63aef2c559d72 (patch)
tree425b0f4ae2fa53ff6b886b1e4ec9aac7e4c44651 /gear/__init__.py
parent5ba75492f115ac7e747957f2b00e29b6c560c797 (diff)
downloadgear-178eae1dcf43db3647d18e7f5fe63aef2c559d72.tar.gz
Add readPacket unit test
Add a unit test for readPacket as used by ServerConnection. Change-Id: I8117152b2429407b9d41d146facb63fb70a185f7
Diffstat (limited to 'gear/__init__.py')
-rw-r--r--gear/__init__.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/gear/__init__.py b/gear/__init__.py
index 76b5b16..f27ebc5 100644
--- a/gear/__init__.py
+++ b/gear/__init__.py
@@ -573,6 +573,18 @@ class Packet(object):
extra = ''
return '<gear.Packet 0x%x type: %s%s>' % (id(self), ptype, extra)
+ def __eq__(self, other):
+ if not isinstance(other, Packet):
+ return False
+ if (self.code == other.code and
+ self.ptype == other.ptype and
+ self.data == other.data):
+ return True
+ return False
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
def _formatExtraData(self):
if self.ptype in [constants.JOB_CREATED,
constants.JOB_ASSIGN,