1# Test empty data structures, in storage and in entrypoints.
2
3import smartpy as sp
4
5
6@sp.module
7def main():
8 class C(sp.Contract):
9 def __init__(self):
10 self.data.m1 = {}
11 self.data.m2 = {"a": "b"}
12 self.data.l1 = []
13 self.data.l2 = ["c"]
14 self.data.o1 = None
15 # self.data.o2 = sp.Some('d') # This should be uncommented. See #41.
16
17 @sp.entrypoint
18 def ep1(self):
19 self.data.m1 = {"e": "f"}
20 self.data.l1 = ["g"]
21 self.data.o1 = sp.Some("h")
22
23 @sp.entrypoint
24 def ep2(self):
25 self.data.m2 = {}
26 self.data.l2 = []
27 # self.data.o2 = None
28
29
30@sp.add_test()
31def test():
32 scenario = sp.test_scenario("test", main)
33 c = main.C()
34 scenario.h1("Empty")
35 scenario += c
36 c.ep1()
37 c.ep2()