templates.test_modules5
1import smartpy as sp 2 3 4@sp.module 5def M2(): 6 x = 42 7 8 target = x 9 10 def inc(y): 11 return y + 1 12 13 def f(y, z): 14 return y + z 15 16 class C(sp.Contract): 17 @sp.entrypoint 18 def ep(self, params): 19 assert f(sp.record(y=1, z=2)) == 3 20 assert params == inc(42) 21 pass 22 assert params == 43 23 assert params == target + 1 24 25 26@sp.add_test() 27def test(): 28 s = sp.test_scenario("Test", M2) 29 c = M2.C() 30 s += c 31 c.ep(43)