templates.test_unification
1import smartpy as sp 2 3 4@sp.module 5def main(): 6 class TestUnification(sp.Contract): 7 def __init__(self): 8 self.data.x = None 9 10 @sp.entrypoint 11 def push(self, params): 12 sp.cast(params, sp.int) 13 self.data.x = sp.Some(params) 14 15 16if "main" in __name__: 17 18 @sp.add_test() 19 def test(): 20 scenario = sp.test_scenario("TestUnification", main) 21 c1 = main.TestUnification() 22 scenario += c1 23 c1.push(4)