def test_example(self): functions = StatefulFunctions() @functions.bind(typename="org.foo/greeter", specs=[ValueSpec(name='seen_count', type=IntType)]) def greeter(context, message): pass fun = functions.for_typename("org.foo/greeter") self.assertFalse(fun.is_async) self.assertIsNotNone(fun.storage_spec)
def test_state_spec(self): functions = StatefulFunctions() foo = ValueSpec(name='foo', type=IntType) bar = ValueSpec(name='bar', type=StringType) @functions.bind(typename="org.foo/greeter", specs=[foo, bar]) def greeter(context, message): pass fun = functions.for_typename("org.foo/greeter") self.assertListEqual(fun.storage_spec.specs, [foo, bar])