templates.test_never

 1import smartpy as sp
 2
 3
 4@sp.module
 5def main():
 6    class MyContract(sp.Contract):
 7        def __init__(self, x):
 8            self.data.x = x
 9
10        @sp.entrypoint
11        def entrypoint_1(self, params):
12            with sp.match(params):
13                with sp.case.A as a:
14                    self.data.x = a + 12
15                with sp.case.B as b:
16                    sp.never(b)
17
18        @sp.entrypoint
19        def entrypoint_1(self, params):
20            sp.cast(params, sp.record(a=sp.int, b=sp.never))
21            self.data.x = params.a
22
23
24@sp.add_test()
25def test():
26    scenario = sp.test_scenario("Never", main)
27    scenario.h1("Never")
28    c1 = main.MyContract(x=0)
29    scenario += c1