templates.test_modules9
1import smartpy as sp 2 3 4@sp.module 5def main(): 6 class A(sp.Contract): 7 def __init__(self, x): 8 self.data.x = x 9 self.private.a = 42 10 self.private.b = 43 11 12 @sp.entrypoint 13 def ep(self, param): 14 assert param == self.private.a 15 16 17@sp.add_test() 18def test(): 19 s = sp.test_scenario("Test", main) 20 21 a1 = main.A(0) 22 s += a1 23 a1.ep(42) 24 a1.ep(100, _valid=False) 25 s.verify(a1.private.a == 42)