Testing

Unit Testing

See the tests in lib directory to see different uses of these helpers.

class tests.helpers.UnitTestingApp[source]
tests.helpers.assert_output(app: Application, inputs: list[dict[str, Any]], outputs: list[Any], opups: int = 0) None[source]

Creates and calls the UnitTestingApp passed and compares the return value with the expected output

Parameters
  • app – An instance of a UnitTestingApp to make call against its unit_test method

  • inputs – A list of dicts where each entry contains keys matching the input args for the unit_test method and values corresponding to the type expected by the method

  • outputs – A list of outputs to compare against the return value of the output of the unit_test method

  • opups – A number of additional app call transactions to make to increase our budget

Balance Checking

Some basic functions are available for retrieving and comparing balances for accounts involved in tests.

See the examples/amm/amm_test.py for usage example.

tests.helpers.get_balances(client: AlgodClient, accts: list[str]) dict[str, dict[int, int]][source]

get the balances for all the accounts in the list passed

tests.helpers.get_deltas(acct_balances_before: dict[str, dict[int, int]], acct_balances_after: dict[str, dict[int, int]]) dict[str, dict[int, int]][source]

get the difference between the balances before and after some event

State Checking

TODO :)