algopy_testing.context
Module Contents
Section titled “Module Contents”Classes
Section titled “Classes”AlgopyTestContext | Manages the testing context for Algorand Python SDK (algopy) applications. |
|---|
class AlgopyTestContext
Section titled “class AlgopyTestContext”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
property default_sender : algopy.Account
Section titled “property default_sender : algopy.Account”Get the default sender account.
- Returns: The default sender account
- Return type: algopy.Account
Access the value generators.
- Returns: The value generator
- Return type: AlgopyValueGenerator
property ledger : LedgerContext
Section titled “property ledger : LedgerContext”Access the ledger context.
- Returns: The ledger context
- Return type: LedgerContext
property txn : TransactionContext
Section titled “property txn : TransactionContext”Access the transaction context.
- Returns: The transaction context
- Return type: TransactionContext
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_transaction_context() → None
Section titled “clear_transaction_context() → None”Clear the transaction context.
reset() → None
Section titled “reset() → None”Reset the test context to its initial state, clearing all data and resetting ID counters.