burr
burr copied to clipboard
Validate `with_entrypoint` and `with_transitions` to check if the types are strings
This should fail for two reasons and mention that the type should be a string, not an action. It should also explain why (because they don't have names until they're added in):
from burr.core import action, State, ApplicationBuilder, default
@action(reads=[], writes=["list"])
def append(state: State) -> tuple[dict, State]:
return state.append(list=1)
app = (
ApplicationBuilder()
.with_state(list=[])
.with_actions(append=append)
.with_entrypoint(append)
.with_transitions(
(append, append, default),
)
.build()
)
old_state = app.state
action, result, new_state = app.step()
print(old_state, new_state)