Skip to content

Test Runner generating invalid result json when there's iterators in the result stack #46

@meevee98

Description

@meevee98

I'm using Neo Test Runner to run some tests and found out that it generates a invalid json when the invocation has interators in its results
image

I am testing a simple smart contract written in Python:

from typing import Union, Any

from boa3.builtin.compile_time import NeoMetadata, public
from boa3.builtin.interop import storage
from boa3.builtin.interop.iterator import Iterator
from boa3.builtin.type import ByteString


@metadata
def manifest_metadata() -> NeoMetadata:
    meta = NeoMetadata()
    meta.name = 'Example'
    return meta


@public
def find_by_prefix(prefix: bytes) -> Iterator:
    return storage.find(prefix)


@public
def put_on_storage(key: ByteString, value: Union[int, ByteString]):
    storage.put(key, value)


@public
def _deploy(data: Any, update: bool):
    # test data to test in unit tests
    storage.put('example_0', '0')
    storage.put('example_1', '1')
    storage.put('example_2', '2')

with this invoke file:

[{"contract":"Example","operation":"find_by_prefix","args":["0x74657374"]},{"contract":"Example","operation":"find_by_prefix","args":["0x6578616d706c65"]}]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions