_algopy_testing.value_generators.arc4

Module Contents

Classes

ARC4ValueGenerator

Factory for generating ARC4-compliant test data.

API

class ARC4ValueGenerator

Factory for generating ARC4-compliant test data.

address() algopy.arc4.Address

Generate a random Algorand address.

Returns:

A new, random Algorand address.

uint8(min_value: int = 0, max_value: int = MAX_UINT8) algopy.arc4.UInt8

Generate a random UInt8 within the specified range.

Parameters:
  • min_value – Minimum value (inclusive). Defaults to 0.

  • max_value – Maximum value (inclusive). Defaults to MAX_UINT8.

Returns:

A random UInt8 value.

uint16(min_value: int = 0, max_value: int = MAX_UINT16) algopy.arc4.UInt16

Generate a random UInt16 within the specified range.

Parameters:
  • min_value – Minimum value (inclusive). Defaults to 0.

  • max_value – Maximum value (inclusive). Defaults to MAX_UINT16.

Returns:

A random UInt16 value.

uint32(min_value: int = 0, max_value: int = MAX_UINT32) algopy.arc4.UInt32

Generate a random UInt32 within the specified range.

Parameters:
  • min_value – Minimum value (inclusive). Defaults to 0.

  • max_value – Maximum value (inclusive). Defaults to MAX_UINT32.

Returns:

A random UInt32 value.

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

Generate a random UInt64 within the specified range.

Parameters:
  • min_value – Minimum value (inclusive). Defaults to 0.

  • max_value – Maximum value (inclusive). Defaults to MAX_UINT64.

Returns:

A random UInt64 value.

biguint128(
min_value: int = 0,
max_value: int = 1 << 128 - 1,
) algopy.arc4.UInt128

Generate a random UInt128 within the specified range.

Parameters:
  • min_value – Minimum value (inclusive). Defaults to 0.

  • max_value – Maximum value (inclusive). Defaults to (2^128 - 1).

Returns:

A random UInt128 value.

biguint256(
min_value: int = 0,
max_value: int = 1 << 256 - 1,
) algopy.arc4.UInt256

Generate a random UInt256 within the specified range.

Parameters:
  • min_value – Minimum value (inclusive). Defaults to 0.

  • max_value – Maximum value (inclusive). Defaults to (2^256 - 1).

Returns:

A random UInt256 value.

biguint512(
min_value: int = 0,
max_value: int = MAX_UINT512,
) algopy.arc4.UInt512

Generate a random UInt512 within the specified range.

Parameters:
  • min_value – Minimum value (inclusive). Defaults to 0.

  • max_value – Maximum value (inclusive). Defaults to MAX_UINT512.

Returns:

A random UInt512 value.

dynamic_bytes(n: int) algopy.arc4.DynamicBytes

Generate a random dynamic bytes of size n bits.

Parameters:

n – The number of bits for the dynamic bytes. Must be a multiple of 8, otherwise the last byte will be truncated.

Returns:

A new, random dynamic bytes of size n bits.

string(n: int) algopy.arc4.String

Generate a random string of size n bits.

Parameters:

n – The number of bits for the string.

Returns:

A new, random string of size n bits.