templates.test_self_data_set
1import smartpy as sp 2 3 4@sp.module 5def main(): 6 t: type = sp.record(address=sp.option[sp.int]) 7 8 class Test(sp.Contract): 9 def __init__(self): 10 self.data.address = None 11 sp.cast(self.data, t) 12 13 @sp.entrypoint 14 def a(self, params): 15 self.data = params 16 17 @sp.entrypoint 18 def b(self, params): 19 self.data.address = params 20 21 22@sp.add_test() 23def test(): 24 scenario = sp.test_scenario("Tests", main) 25 scenario += main.Test()