mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Use __eq__ to compare objects
This commit is contained in:
parent
3d967acde4
commit
febb63f198
@ -46,6 +46,9 @@ class Fulfillment(object):
|
|||||||
else:
|
else:
|
||||||
self.owners_before = owners_before
|
self.owners_before = owners_before
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
return self.to_dict() == other.to_dict()
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
try:
|
try:
|
||||||
# When we have signed the fulfillment, this will work
|
# When we have signed the fulfillment, this will work
|
||||||
@ -111,6 +114,9 @@ class TransactionLink(object):
|
|||||||
def __bool__(self):
|
def __bool__(self):
|
||||||
return not (self.txid is None and self.cid is None)
|
return not (self.txid is None and self.cid is None)
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
return self.to_dict() == self.to_dict()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_dict(cls, link):
|
def from_dict(cls, link):
|
||||||
try:
|
try:
|
||||||
@ -146,6 +152,9 @@ class Condition(object):
|
|||||||
else:
|
else:
|
||||||
self.owners_after = owners_after
|
self.owners_after = owners_after
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
return self.to_dict() == other.to_dict()
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
return {
|
return {
|
||||||
'owners_after': self.owners_after,
|
'owners_after': self.owners_after,
|
||||||
@ -167,6 +176,9 @@ class Data(object):
|
|||||||
else:
|
else:
|
||||||
self.payload = payload
|
self.payload = payload
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
return self.to_dict() == other.to_dict()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_dict(cls, payload):
|
def from_dict(cls, payload):
|
||||||
try:
|
try:
|
||||||
@ -263,6 +275,9 @@ class Transaction(object):
|
|||||||
else:
|
else:
|
||||||
self.data = data
|
self.data = data
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
return self.to_dict() == other.to_dict()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, owners_before, owners_after, inputs, operation, payload=None):
|
def create(cls, owners_before, owners_after, inputs, operation, payload=None):
|
||||||
if operation == Transaction.CREATE or operation == Transaction.GENESIS:
|
if operation == Transaction.CREATE or operation == Transaction.GENESIS:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user