Skip to content

algopy_testing.context

AlgopyTestContextManages the testing context for Algorand Python SDK (algopy) applications.

Manages the testing context for Algorand Python SDK (algopy) applications.

This class provides methods and properties to simulate various aspects of the Algorand blockchain environment, including accounts, assets, applications, transactions, and global state. It allows for easy setup and manipulation of test scenarios for algopy-based smart contracts and applications.

  • Parameters:
    • default_sender – The default sender account address, defaults to None
    • template_vars – Dictionary of template variables, defaults to None

Get the default sender account.

  • Returns: The default sender account
  • Return type: algopy.Account

Access the value generators.

Access the ledger context.

Access the transaction context.

set_template_var(name: str, value: Any) → None

Section titled “set_template_var(name: str, value: Any) → None”

Set a template variable for the current context.

  • Parameters:
    • name – The name of the template variable
    • value – The value to assign to the template variable

execute_logicsig(lsig: algopy.LogicSig, *args: Any) → bool | algopy.UInt64

Section titled “execute_logicsig(lsig: algopy.LogicSig, *args: Any) → bool | algopy.UInt64”

Execute a logic signature.

If the logicsig’s wrapped function accepts parameters, args are passed directly. args are also available via algopy.op.arg().

Clear the transaction context.

Reset the test context to its initial state, clearing all data and resetting ID counters.