You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Algorand Python is a partial implementation of the Python programming language that runs on the AVM. It includes a statically typed framework for development of Algorand smart contracts and logic signatures, with Pythonic interfaces to underlying AVM functionality that works with standard Python tooling.
3
+
Algorand Python is a partial implementation of the Python programming language that runs on the AVM. It includes a statically typed framework for developing Algorand smart contracts and logic signatures, with Pythonic interfaces to underlying AVM functionality that work with standard Python tooling.
4
4
5
-
Algorand Python is compiled for execution on the AVM by PuyaPy, an optimising compiler that ensures the resulting AVM bytecode execution semantics that match the given Python code. PuyaPy produces output that is directly compatible with [AlgoKit typed clients](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/features/generate.md#1-typed-clients) to make deployment and calling easy.
5
+
Algorand Python is compiled for execution on the AVM by PuyaPy, an optimising compiler that ensures the resulting AVM bytecode has execution semantics that match the given Python code. PuyaPy produces output that is directly compatible with [AlgoKit typed clients](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/features/generate.md#1-typed-clients) to make deployment and calling easy.
6
6
7
7
## Quick start
8
8
9
-
To get started refer to the [official documentation](https://algorandfoundation.github.io/puya).
9
+
To get started, refer to the [official documentation](https://algorandfoundation.github.io/puya).
Copy file name to clipboardExpand all lines: docs/api.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
# API Reference
2
2
3
-
An overview of the `algorand-python-testing`'s `algopy_testing` module - covering the main classes and functions.
3
+
An overview of the `algopy_testing` module in `algorand-python-testing` library - covering the main classes and functions.
4
4
5
5
```{hint}
6
-
Spotted a typo in documentation? This project is open source, please submit an issue or a PR on [GitHub](https://github.com/algorand/algorand-python-testing).
6
+
Spotted a typo in the documentation? This project is open source; please submit an issue or a PR on [GitHub](https://github.com/algorandfoundation/algorand-python-testing).
7
7
```
8
8
9
9
```{warning}
10
-
Note, assume `_algopy_testing` to refer to `algopy_testing` namespace in the auto-generated class documentation above. To be patched in near future.
10
+
Note: Auto-generated class documentation may reference `_algopy_testing`; these should be interpreted as the `algopy_testing` namespace. The naming discrepancy will be fixed in a future update.
Copy file name to clipboardExpand all lines: docs/coverage.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
# Coverage
2
2
3
-
See which `algorand-python` stubs are implemented by the `algorand-python-testing` library. See the [Concepts](testing-guide/concepts.md#types-of-algopy-stub-implementations) section for more details on the implementation categories. Refer to the [`algorand-python` stubs API](api.md) for the full list of the stubs for which the `algorand-python-testing` library provides implementations referenced in the table below.
3
+
See which `algorand-python` stubs are implemented by the `algorand-python-testing` library. See the [Concepts](testing-guide/concepts.md#types-of-algopy-stub-implementations) section for more details on the implementation categories. Refer to the [`algorand-python` stubs API](api.md) for the full list of stubs for which the `algorand-python-testing` library provides implementations referenced in the table below.
| Auction |[test_contract.py](https://github.com/algorandfoundation/algorand-python-testing/blob/main/examples/auction/test_contract.py)| - Use of algopy_testing_context<br>- Mocking of global state and transaction fields<br>- Testing of ARC4 contract methods<br>- Emulation of asset creation and transfers<br>- Verification of inner transactions | - **ARC4Contract**<br>- **Global**<br>- **Txn**<br>- **Asset**<br>- **Account**<br>- **LocalState**|
8
-
| Proof of Attendance |[test_contract.py](https://github.com/algorandfoundation/algorand-python-testing/blob/main/examples/proof_of_attendance/test_contract.py)| - Creation and management of dummy assets<br>- Testing of box storage operations<br>- Verification of inner transactions for asset transfers<br>- Use of any\_\* methods for generating test data | - **ARC4Contract**<br>- **Box**<br>- **BoxMap**<br>- **Asset**<br>- **Account**<br>- **op**|
8
+
| Proof of Attendance |[test_contract.py](https://github.com/algorandfoundation/algorand-python-testing/blob/main/examples/proof_of_attendance/test_contract.py)| - Creation and management of dummy assets<br>- Testing of box storage operations<br>- Verification of inner transactions for asset transfers<br>- Use of `any.*` methods for generating test data | - **ARC4Contract**<br>- **Box**<br>- **BoxMap**<br>- **Asset**<br>- **Account**<br>- **op**|
9
9
| Simple Voting |[test_contract.py](https://github.com/algorandfoundation/algorand-python-testing/blob/main/examples/simple_voting/test_contract.py)| - Testing of global and local state operations<br>- Verification of transaction group operations<br>- Mocking of payment transactions | - **Contract**<br>- **GlobalState**<br>- **LocalState**<br>- **Txn**<br>- **op.GTxn**|
10
-
| ZK Whitelist |[test_contract.py](https://github.com/algorandfoundation/algorand-python-testing/blob/main/examples/zk_whitelist/test_contract.py)| - Testing of zero-knowledge proof verification<br>- Mocking of external application calls<br>- Use of ARC4 types and methods | - **ARC4Contract**<br>- **arc4 types**<br>- **LocalState**<br>- **Global**<br>- **Txn**|
10
+
| ZK Whitelist |[test_contract.py](https://github.com/algorandfoundation/algorand-python-testing/blob/main/examples/zk_whitelist/test_contract.py)| - Testing of zero-knowledge proof verification<br>- Mocking of external application calls<br>- Use of ARC4 types and methods | - **ARC4Contract**<br>- **ARC4 types**<br>- **LocalState**<br>- **Global**<br>- **Txn**|
11
11
| HTLC LogicSig |[test_signature.py](https://github.com/algorandfoundation/algorand-python-testing/blob/main/examples/htlc_logicsig/test_signature.py)| - Testing of LogicSig contracts<br>- Verification of time-based conditions<br>- Mocking of transaction parameters | - **logicsig**<br>- **Account**<br>- **Txn**<br>- **Global**<br>- **op**|
12
-
| Marketplace |[test_contract.py](https://github.com/algorandfoundation/algorand-python-testing/blob/main/examples/marketplace/test_contract.py)| - Testing of complex marketplace operations<br>- Use of BoxMap for listings<br>- Testing of asset transfers and payments | - **ARC4Contract**<br>- **BoxMap**<br>- **Asset**<br>- **arc4 types**<br>- **Global**<br>- **Txn**|
12
+
| Marketplace |[test_contract.py](https://github.com/algorandfoundation/algorand-python-testing/blob/main/examples/marketplace/test_contract.py)| - Testing of complex marketplace operations<br>- Use of BoxMap for listings<br>- Testing of asset transfers and payments | - **ARC4Contract**<br>- **BoxMap**<br>- **Asset**<br>- **ARC4 types**<br>- **Global**<br>- **Txn**|
13
13
| Scratch Storage |[test_contract.py](https://github.com/algorandfoundation/algorand-python-testing/blob/main/examples/scratch_storage/test_contract.py)| - Testing of scratch space usage<br>- Verification of scratch slot values | - **ARC4Contract**<br>- **Contract**<br>- **op**|
Copy file name to clipboardExpand all lines: docs/faq.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Operational Codes, or opcodes, are AVM instructions that are executed directly b
14
14
15
15
## What are Value Generators?
16
16
17
-
Value Generators are helper methods that generate randomized values for testing when the specific value of the tested type is not important. In the context of Algorand Python testing, these are represented by property on the context manager, accessed via `any.*` (or `any.arc4.*`, `any.txn.*`. in the case of ARC 4 types). To understand how to use Value Generators effectively, check out our [Value Generators section](testing-guide/concepts.md#value-generators) in the documentation.
17
+
Value Generators are helper methods that produce randomized values for testing when the exact value of a type isn't important. In Algorand Python testing these generators are exposed as properties on the test context manager and accessed via `any.*` (for example, `any.arc4.*` and `any.txn.*` for ARC4 types). To learn more, see the [Value Generators section](testing-guide/concepts.md#value-generators).
18
18
19
19
## What are the limitations of the Algorand Python Testing framework?
20
20
@@ -26,7 +26,7 @@ The Algorand Python Testing framework emulates the Algorand Virtual Machine (AVM
26
26
4. Certain cryptographic operations are mocked or simplified
27
27
5. No state proof generation or verification
28
28
29
-
For scenarios where these limitations are crucial, it's recommended to pair this framework with integration testing. If you have a solid reason to justify introducing new emulated behaviour, please open an issue or contribute to the project on [Github](https://github.com/algorandfoundation/algorand-python-testing).
29
+
For scenarios where these limitations are crucial, it's recommended to pair this framework with integration testing. If you have a solid reason to justify introducing new emulated behaviour, please open an issue or contribute to the project on [GitHub](https://github.com/algorandfoundation/algorand-python-testing).
30
30
31
31
## How does balance tracking work in the testing framework?
32
32
@@ -46,16 +46,16 @@ Some cryptographic operations are mocked or simplified in the framework. For a d
46
46
47
47
## Can I use this framework for security-critical validations?
48
48
49
-
While this framework is useful for unit testing and local development, it should not be the only tool used for security-critical validations or performance benchmarking. It's designed to approximate AVM behavior for common scenarios. Always complement your testing with additional integration testing options available in `algokit`, where you can test against real localnet or testnet environments.
49
+
While this framework is useful for unit testing and local development, it should not be the only tool used for security-critical validations or performance benchmarking. It's designed to approximate AVM behaviour for common scenarios. Always complement your testing with additional integration testing options available in `algokit`, where you can test against real localnet or testnet environments.
50
50
51
51
## Is there an example of how to use this framework alongside integration tests?
52
52
53
53
Yes, the `algokit-python-template`, accessible via `algokit init`, provides a working example of how to structure `algorand-python-testing` along with regular integration tests against localnet.
54
54
55
55
```{hint}
56
-
An `algokit-python-template` accessible via `algokit init -t python`, provides a comprehensive and customizable working example of how to structure `algorand-python-testing` along with regular integration tests against localnet.
56
+
The `algokit-python-template`, accessible via `algokit init -t python`, provides a comprehensive and customizable working example of how to structure `algorand-python-testing` along with regular integration tests against localnet.
57
57
```
58
58
59
59
## Is it compatible with `pytest`?
60
60
61
-
Yes, it is compatible with `pytest` and _any_ other python testing framework as its agnostic of the testing framework as long as its python. If you spot incompatibility with a certain tool, please open an issue or contribute to the project on [Github](https://github.com/algorandfoundation/algorand-python-testing).
61
+
Yes, it is compatible with `pytest` and _any_ other Python testing framework as it is agnostic of the testing framework as long as it's Python. If you spot incompatibility with a certain tool, please open an issue or contribute to the project on [GitHub](https://github.com/algorandfoundation/algorand-python-testing).
`algorand-python-testing` is a companion package to [Algorand Python](https://github.com/algorandfoundation/puya) that enables efficient unit testing of Algorand Python smart contracts in an offline environment. This package emulates key AVM behaviors without requiring a network connection, offering fast and reliable testing capabilities with a familiar Pythonic interface.
8
+
`algorand-python-testing` is a companion package to [Algorand Python](https://github.com/algorandfoundation/puya) that enables efficient unit testing of Algorand Python smart contracts in an offline environment. This package emulates key AVM behaviours without requiring a network connection, offering fast and reliable testing capabilities with a familiar Pythonic interface.
9
9
10
10
The `algorand-python-testing` package provides:
11
11
@@ -160,7 +160,7 @@ This example demonstrates key aspects of testing with `algorand-python-testing`
160
160
- Checking global and local state changes after method execution.
161
161
- Verifying return values from ABI methods using ARC4-specific types.
162
162
163
-
> **NOTE**: Thorough testing is crucial in smart contract development due to their immutable nature post-deployment. Comprehensive unit and integration tests ensure contract validity and reliability. Optimizing for efficiency can significantly improve user experience by reducing transaction fees and simplifying interactions. Investing in robust testing and optimization practices is crucial and offers many benefits in the long run.
163
+
> **NOTE**: Thorough testing is crucial in smart contract development due to their immutable nature post-deployment. Comprehensive unit and integration tests ensure contract validity and reliability. Optimising for efficiency can significantly improve user experience by reducing transaction fees and simplifying interactions. Investing in robust testing and optimisation practices is crucial and offers many benefits in the long run.
Copy file name to clipboardExpand all lines: docs/testing-guide/arc4-types.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
# ARC4 Types
2
2
3
-
These types are available under the `algopy.arc4` namespace. Refer to the [ARC4 specification](https://arc.algorand.foundation/ARCs/arc-0004) for more details on the spec.
3
+
These types are available under the `algopy.arc4` namespace. Refer to the [ARC4 specification](https://dev.algorand.co/arc-standards/arc-0004/) for more details on the spec.
4
4
5
5
```{hint}
6
-
Test context manager provides _value generators_ for ARC4 types. To access their _value generators_, use `{context_instance}.any.arc4` property. See more examples below.
6
+
The test context manager provides _value generators_ for ARC4 types. To access the _value generators_, use `{context_instance}.any.arc4` property. See more examples below.
Copy file name to clipboardExpand all lines: docs/testing-guide/avm-types.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
These types are available directly under the `algopy` namespace. They represent the basic AVM primitive types and can be instantiated directly or via _value generators_:
4
4
5
5
```{note}
6
-
For 'primitive `algopy` types such as `Account`, `Application`, `Asset`, `UInt64`, `BigUint`, `Bytes`, `Sting` with and without respective _value generator_, instantiation can be performed directly. If you have a suggestion for a new _value generator_ implementation, please open an issue in the [`algorand-python-testing`](https://github.com/algorandfoundation/algorand-python-testing) repository or contribute by following the [contribution guide](https://github.com/algorandfoundation/algorand-python-testing/blob/main/CONTRIBUTING.md).
6
+
For primitive `algopy` types such as `Account`, `Application`, `Asset`, `UInt64`, `BigUint`, `Bytes`, and `String`, instantiation can be performed directly, with or without a corresponding _value generator_. If you have a suggestion for a new _value generator_ implementation, please open an issue in the [`algorand-python-testing`](https://github.com/algorandfoundation/algorand-python-testing) repository or contribute by following the [contribution guide](https://github.com/algorandfoundation/algorand-python-testing/blob/main/CONTRIBUTING.md).
0 commit comments