Skip to content

Commit

Permalink
Fix python
Browse files Browse the repository at this point in the history
  • Loading branch information
thibault-martinez committed Mar 1, 2024
1 parent 53eb7ee commit 467e0dd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
6 changes: 4 additions & 2 deletions bindings/python/iota_sdk/types/output_id_proof.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
13 changes: 5 additions & 8 deletions bindings/python/tests/test_api_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/'
Expand All @@ -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
Expand Down Expand Up @@ -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")
Expand Down
6 changes: 3 additions & 3 deletions sdk/tests/types/api/fixtures/get-info-response-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down

0 comments on commit 467e0dd

Please sign in to comment.