_algopy_testing.value_generators.avm

Module Contents

Classes

AVMValueGenerator

Factory for generating test data for AVM abstractions (uint64, bytes, string, accounts, assets and applications).

API

class AVMValueGenerator

Factory for generating test data for AVM abstractions (uint64, bytes, string, accounts, assets and applications).

uint64(min_value: int = 0, max_value: int = MAX_UINT64) algopy.UInt64

Generate a random UInt64 value within a specified range.

Parameters:
  • min_value – Minimum value. Defaults to 0.

  • max_value – Maximum value. Defaults to MAX_UINT64.

Returns:

The randomly generated UInt64 value.

Raises:

ValueError – If max_value exceeds MAX_UINT64 or min_value exceeds max_value.

biguint(min_value: int = 0) algopy.BigUInt

Generate a random BigUInt value within a specified range.

Parameters:

min_value – Minimum value. Defaults to 0.

Returns:

The randomly generated BigUInt value.

Raises:

ValueError – If min_value is negative.

bytes(length: int | None = None) algopy.Bytes

Generate a random byte sequence of a specified length.

Parameters:

length – Length of the byte sequence. Defaults to MAX_BYTES_SIZE.

Returns:

The randomly generated byte sequence.

string(length: int = MAX_BYTES_SIZE) algopy.String

Generate a random string of a specified length.

Parameters:

length – int: (Default value = MAX_BYTES_SIZE)

Returns:

The randomly generated string.

asset(
asset_id: int | None = None,
**asset_fields: Unpack[_algopy_testing.models.asset.AssetFields],
) algopy.Asset

Generate and add a new asset with a unique ID.

application(
id: int | None = None,
address: algopy.Account | None = None,
logs: list[bytes] | None = None,
**application_fields: Unpack[_algopy_testing.models.application.ApplicationFields],
) algopy.Application

Generate and add a new application with a unique ID.