Skip to content

algopy_testing.mutable

MutableBytesHelper class to ensure mutable algopy types (currently ARC4 array, tuple and
set_item_on_mutate(→ TItem)Used to update a container-like type when an item is modified.
set_attr_on_mutate(→ TItem)Used to update an object-like type when an attr is modified.
add_mutable_callback(→ TItem)Add on_mutate callback to value, if value is mutable.
TKey
TItem

Helper class to ensure mutable algopy types (currently ARC4 array, tuple and structs) cascade their changes to parent container types (global/local state, boxes, ARC4 array, tuple and structs)

set_item_on_mutate(container: object, index: object, value: TItem) → TItem

Section titled “set_item_on_mutate(container: object, index: object, value: TItem) → TItem”

Used to update a container-like type when an item is modified.

set_attr_on_mutate(parent: object, name: str, value: TItem) → TItem

Section titled “set_attr_on_mutate(parent: object, name: str, value: TItem) → TItem”

Used to update an object-like type when an attr is modified.

add_mutable_callback(on_mutate: Callable[[Any], None], value: TItem) → TItem

Section titled “add_mutable_callback(on_mutate: Callable[[Any], None], value: TItem) → TItem”

Add on_mutate callback to value, if value is mutable.

Returns value to simplify usage