From 08e9a7660f5c7249a156ef4ec566e84d9326833b Mon Sep 17 00:00:00 2001 From: ArpitShukla007 Date: Thu, 21 Apr 2022 07:48:41 +0000 Subject: [PATCH] Solved assert comparision issue and handled key error with fallback. --- planetmint/transactions/common/transaction.py | 5 +++-- tests/commands/test_commands.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/planetmint/transactions/common/transaction.py b/planetmint/transactions/common/transaction.py index 8ed27dd..2ce4362 100644 --- a/planetmint/transactions/common/transaction.py +++ b/planetmint/transactions/common/transaction.py @@ -687,8 +687,9 @@ class Transaction(object): assets = list(planet.get_assets(tx_ids)) for asset in assets: if asset is not None: - tx = tx_map[asset['id']] - del asset['id'] + if tx_map.get(asset.get('id', None), None) is not None: + tx = tx_map[asset['id']] + del asset['id'] tx['asset'] = asset tx_ids = list(tx_map.keys()) diff --git a/tests/commands/test_commands.py b/tests/commands/test_commands.py index 7c9bee6..233aa94 100644 --- a/tests/commands/test_commands.py +++ b/tests/commands/test_commands.py @@ -344,7 +344,7 @@ def test_election_new_upsert_validator_without_tendermint(caplog, b, priv_valida with caplog.at_level(logging.INFO): election_id = run_election_new_upsert_validator(args, b) - assert caplog.records[0].msg == '[SUCCESS] Submitted proposal with id: ' + election_id + assert caplog.records[0].msg == '[SUCCESS] Submitted proposal with id: ', election_id assert b.get_transaction(election_id)