From 467e0ddd86ea6ea63eda78b2a7b3627afd179157 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Fri, 1 Mar 2024 10:19:25 +0100 Subject: [PATCH] Fix python --- bindings/python/iota_sdk/types/output_id_proof.py | 6 ++++-- bindings/python/tests/test_api_responses.py | 13 +++++-------- .../api/fixtures/get-info-response-example.json | 6 +++--- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/bindings/python/iota_sdk/types/output_id_proof.py b/bindings/python/iota_sdk/types/output_id_proof.py index ceaca65834..d4ee905f56 100644 --- a/bindings/python/iota_sdk/types/output_id_proof.py +++ b/bindings/python/iota_sdk/types/output_id_proof.py @@ -15,7 +15,7 @@ class OutputCommitmentProofType(IntEnum): Attributes: HashableNode (0): Denotes a HashableNode. LeafHash (1): Denotes a LeafHash. - Valuehash (2): Denotes a Valuehash. + ValueHash (2): Denotes a ValueHash. """ HashableNode = 0 LeafHash = 1 @@ -88,7 +88,9 @@ class OutputIdProof: slot: SlotIndex output_index: int transaction_commitment: HexStr - output_commitment_proof: OutputCommitmentProof + output_commitment_proof: OutputCommitmentProof = field(metadata=config( + decoder=deserialize_proof + )) OutputCommitmentProof: TypeAlias = Union[HashableNode, LeafHash, ValueHash] diff --git a/bindings/python/tests/test_api_responses.py b/bindings/python/tests/test_api_responses.py index 8860685aa9..225c311b50 100644 --- a/bindings/python/tests/test_api_responses.py +++ b/bindings/python/tests/test_api_responses.py @@ -3,7 +3,7 @@ from typing import Generic, TypeVar from json import load, loads, dumps -from iota_sdk import RoutesResponse, CongestionResponse, ManaRewardsResponse, ValidatorResponse, CommitteeResponse, IssuanceBlockHeaderResponse, Block, BlockMetadataResponse, BlockWithMetadataResponse, OutputMetadata, OutputResponse, TransactionMetadataResponse, SlotCommitment, UtxoChangesResponse, UtxoChangesFullResponse +from iota_sdk import RoutesResponse, CongestionResponse,OutputWithMetadataResponse, ManaRewardsResponse,ValidatorsResponse, ValidatorResponse,InfoResponse, CommitteeResponse, IssuanceBlockHeaderResponse, Block, BlockMetadataResponse, BlockWithMetadataResponse, OutputMetadata, OutputResponse, TransactionMetadataResponse, SlotCommitment, UtxoChangesResponse, UtxoChangesFullResponse base_path = '../../sdk/tests/types/api/fixtures/' @@ -27,16 +27,14 @@ def test_api_response(cls_type: Generic[T], path: str): # GET /api/routes test_api_response(RoutesResponse, "get-routes-response-example.json") # GET /api/core/v3/info - # TODO: enable when the fixture is updated https://github.com/iotaledger/iota-sdk/issues/2015 - # test_api_response(InfoResponse, "get-info-response-example.json") + test_api_response(InfoResponse, "get-info-response-example.json") # GET /api/core/v3/accounts/{bech32Address}/congestion test_api_response(CongestionResponse, "get-congestion-estimate-response-example.json") # GET /api/core/v3/rewards/{outputId} test_api_response(ManaRewardsResponse, "get-mana-rewards-example.json") # GET /api/core/v3/validators - # TODO: enable when TIP is updated - # test_api_response(ValidatorsResponse, "get-validators-example.json") + test_api_response(ValidatorsResponse, "get-validators-example.json") # GET /api/core/v3/validators/{bech32Address} test_api_response(ValidatorResponse, "get-validator-example.json") # GET /api/core/v3/committee @@ -73,9 +71,8 @@ def test_api_response(cls_type: Generic[T], path: str): test_api_response( OutputMetadata, "get-output-metadata-by-id-response-spent-example.json") # GET /api/core/v3/outputs/{outputId}/full - # TODO: enable when OutputWithMetadata is updated with OutputIdProof https://github.com/iotaledger/iota-sdk/issues/2021 - # test_api_response(OutputWithMetadata, - # "get-full-output-metadata-example.json") + test_api_response(OutputWithMetadataResponse, + "get-full-output-metadata-example.json") # GET /api/core/v3/transactions/{transactionId}/metadata test_api_response(TransactionMetadataResponse, "get-transaction-metadata-by-id-response-example.json") diff --git a/sdk/tests/types/api/fixtures/get-info-response-example.json b/sdk/tests/types/api/fixtures/get-info-response-example.json index f113dce479..683af6d394 100644 --- a/sdk/tests/types/api/fixtures/get-info-response-example.json +++ b/sdk/tests/types/api/fixtures/get-info-response-example.json @@ -14,9 +14,9 @@ "pruningEpoch": 4 }, "metrics": { - "blocksPerSecond": "1.1E+00", - "confirmedBlocksPerSecond": "2.2E+00", - "confirmationRate": "3.3E+00" + "blocksPerSecond": "1.1", + "confirmedBlocksPerSecond": "2.2", + "confirmationRate": "3.3" }, "protocolParameters": [ {