@@ -6,7 +6,6 @@ The [coverage](coverage.md) file provides a comprehensive list of all opcodes an
66
77``` {testsetup}
88import algopy
9- import algopy_testing
109from algopy_testing import algopy_testing_context
1110
1211# Create the context manager for snippets below
@@ -29,7 +28,7 @@ The following opcodes are demonstrated:
2928- ` op.ecdsa_verify `
3029
3130``` {testcode}
32- import algopy.op as op
31+ from algopy import op
3332
3433# SHA256 hash
3534data = algopy.Bytes(b"Hello, World!")
@@ -59,7 +58,7 @@ The following opcodes are demonstrated:
5958- ` op.setbit_uint64 `
6059
6160``` {testcode}
62- import algopy.op as op
61+ from algopy import op
6362
6463# Addition with carry
6564result, carry = op.addw(algopy.UInt64(2**63), algopy.UInt64(2**63))
@@ -80,7 +79,7 @@ These types necessitate interaction with the transaction context:
8079### algopy.op.Global
8180
8281``` {testcode}
83- import algopy.op as op
82+ from algopy import op
8483
8584class MyContract(algopy.ARC4Contract):
8685 @algopy.arc4.abimethod
@@ -102,12 +101,12 @@ assert result == algopy.UInt64(101000)
102101### algopy.op.Txn
103102
104103``` {testcode}
105- import algopy.op as op
104+ from algopy import op
106105
107106class MyContract(algopy.ARC4Contract):
108107 @algopy.arc4.abimethod
109- def check_txn_fields(self) -> algopy.Bytes :
110- return op.Txn.sender
108+ def check_txn_fields(self) -> algopy.arc4.Address :
109+ return algopy.arc4.Address( op.Txn.sender)
111110
112111... # setup context (below assumes available under 'ctx' variable)
113112
@@ -121,7 +120,7 @@ assert result == custom_sender
121120### algopy.op.AssetHoldingGet
122121
123122``` {testcode}
124- import algopy.op as op
123+ from algopy import op
125124
126125class AssetContract(algopy.ARC4Contract):
127126 @algopy.arc4.abimethod
@@ -141,7 +140,7 @@ assert result == algopy.UInt64(5000)
141140### algopy.op.AppGlobal
142141
143142``` {testcode}
144- import algopy.op as op
143+ from algopy import op
145144
146145class StateContract(algopy.ARC4Contract):
147146 @algopy.arc4.abimethod
@@ -162,7 +161,7 @@ assert stored_value == 42
162161### algopy.op.Block
163162
164163``` {testcode}
165- import algopy.op as op
164+ from algopy import op
166165
167166class BlockInfoContract(algopy.ARC4Contract):
168167 @algopy.arc4.abimethod
@@ -180,7 +179,7 @@ assert seed == algopy.op.itob(123456)
180179### algopy.op.AcctParamsGet
181180
182181``` {testcode}
183- import algopy.op as op
182+ from algopy import op
184183
185184class AccountParamsContract(algopy.ARC4Contract):
186185 @algopy.arc4.abimethod
@@ -205,7 +204,7 @@ class AppParamsContract(algopy.ARC4Contract):
205204 def get_app_creator(self, app_id: algopy.Application) -> algopy.arc4.Address:
206205 creator, exists = algopy.op.AppParamsGet.app_creator(app_id)
207206 assert exists
208- return creator
207+ return algopy.arc4.Address( creator)
209208
210209... # setup context (below assumes available under 'ctx' variable)
211210
@@ -218,8 +217,7 @@ assert creator == context.default_sender
218217### algopy.op.AssetParamsGet
219218
220219``` {testcode}
221- from algopy_testing import algopy_testing_context
222- import algopy.op as op
220+ from algopy import op
223221
224222class AssetParamsContract(algopy.ARC4Contract):
225223 @algopy.arc4.abimethod
@@ -239,8 +237,7 @@ assert total == algopy.UInt64(1000000)
239237### algopy.op.Box
240238
241239``` {testcode}
242- from algopy_testing import algopy_testing_context
243- import algopy.op as op
240+ from algopy import op
244241
245242class BoxStorageContract(algopy.ARC4Contract):
246243 @algopy.arc4.abimethod
@@ -329,23 +326,22 @@ assert result == 11
329326``` {testcode}
330327from unittest.mock import patch, MagicMock
331328import algopy
332- from algopy_testing.primitives import Bytes
333329
334330def test_mock_vrf_verify():
335- mock_result = (Bytes(b'mock_output'), True)
331+ mock_result = (algopy. Bytes(b'mock_output'), True)
336332 with patch('algopy.op.vrf_verify', return_value=mock_result) as mock_vrf_verify:
337333 result = algopy.op.vrf_verify(
338334 algopy.op.VrfVerify.VrfAlgorand,
339- Bytes(b'proof'),
340- Bytes(b'message'),
341- Bytes(b'public_key')
335+ algopy. Bytes(b'proof'),
336+ algopy. Bytes(b'message'),
337+ algopy. Bytes(b'public_key')
342338 )
343339 assert result == mock_result
344340 mock_vrf_verify.assert_called_once_with(
345341 algopy.op.VrfVerify.VrfAlgorand,
346- Bytes(b'proof'),
347- Bytes(b'message'),
348- Bytes(b'public_key')
342+ algopy. Bytes(b'proof'),
343+ algopy. Bytes(b'message'),
344+ algopy. Bytes(b'public_key')
349345 )
350346
351347test_mock_vrf_verify()
@@ -356,19 +352,18 @@ test_mock_vrf_verify()
356352``` {testcode}
357353from unittest.mock import patch, MagicMock
358354import algopy
359- from algopy_testing.primitives import Bytes
360355
361356def test_mock_elliptic_curve_decompress():
362- mock_result = (Bytes(b'x_coord'), Bytes(b'y_coord'))
357+ mock_result = (algopy. Bytes(b'x_coord'), algopy. Bytes(b'y_coord'))
363358 with patch('algopy.op.EllipticCurve.decompress', return_value=mock_result) as mock_decompress:
364359 result = algopy.op.EllipticCurve.decompress(
365360 algopy.op.EC.BN254g1,
366- Bytes(b'compressed_point')
361+ algopy. Bytes(b'compressed_point')
367362 )
368363 assert result == mock_result
369364 mock_decompress.assert_called_once_with(
370365 algopy.op.EC.BN254g1,
371- Bytes(b'compressed_point')
366+ algopy. Bytes(b'compressed_point')
372367 )
373368
374369test_mock_elliptic_curve_decompress()
0 commit comments