import pytest from pathlib import Path from pbcabi.binaryreader import BinaryReader import pbcabi.model from pbcabi.data import BlockchainAddress EXAMPLE_SHARDS = [ ("Shard1", 2, "000000000000000000000000000000000000000001"), ("Shard0", 2, "000000000000000000000000000000000000000002"), ("Shard0", 3, "025FA781D389D7C7CAAF836E5E47ABED6CEFD2D928"), ("Shard1", 3, "04FE17D1009372C8ED3AC5B790B32E349359C2C7E9"), ("Shard0", 3, "01A2020BB33EF9E0323C7A3210D5CB7FD492AA0D65"), ] @pytest.mark.parametrize('shard_id,num_shards,address', EXAMPLE_SHARDS) def test_parse_abi(shard_id: int, num_shards:int, address: str): address = BlockchainAddress.from_hex_hash(address) assert address.shard_id(num_shards) == shard_id