mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Problem: memoization for to_dict disabled
Solution: enable memoization and fix failing tests
This commit is contained in:
parent
9280ac62a7
commit
9689072ea4
@ -28,7 +28,7 @@ from bigchaindb.common.exceptions import (KeypairMismatchException,
|
||||
AmountError, AssetIdMismatch,
|
||||
ThresholdTooDeep)
|
||||
from bigchaindb.common.utils import serialize
|
||||
from .memoize import memoize_from_dict # , memoize_to_dict
|
||||
from .memoize import memoize_from_dict, memoize_to_dict
|
||||
|
||||
|
||||
UnspentOutput = namedtuple(
|
||||
@ -1061,7 +1061,7 @@ class Transaction(object):
|
||||
def __hash__(self):
|
||||
return hash(self.id)
|
||||
|
||||
# @memoize_to_dict
|
||||
@memoize_to_dict
|
||||
def to_dict(self):
|
||||
"""Transforms the object to a Python dictionary.
|
||||
|
||||
|
||||
@ -202,7 +202,7 @@ def test_get_owned_ids(signed_create_tx, user_pk):
|
||||
conn = connect()
|
||||
|
||||
# insert a transaction
|
||||
conn.db.transactions.insert_one(signed_create_tx.to_dict())
|
||||
conn.db.transactions.insert_one(deepcopy(signed_create_tx.to_dict()))
|
||||
|
||||
txns = list(query.get_owned_ids(conn, user_pk))
|
||||
|
||||
@ -221,7 +221,7 @@ def test_get_spending_transactions(user_pk, user_sk):
|
||||
tx2 = Transaction.transfer([inputs[0]], out, tx1.id).sign([user_sk])
|
||||
tx3 = Transaction.transfer([inputs[1]], out, tx1.id).sign([user_sk])
|
||||
tx4 = Transaction.transfer([inputs[2]], out, tx1.id).sign([user_sk])
|
||||
txns = [tx.to_dict() for tx in [tx1, tx2, tx3, tx4]]
|
||||
txns = [deepcopy(tx.to_dict()) for tx in [tx1, tx2, tx3, tx4]]
|
||||
conn.db.transactions.insert_many(txns)
|
||||
|
||||
links = [inputs[0].fulfills.to_dict(), inputs[2].fulfills.to_dict()]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user