testserver.TestServerValues
testserver.TestServerValues(is_ok, error, traceback, inputs, outputs, exports)A point-in-time snapshot of a test session's input, output, and export values.
Returned by TestServerSession.to_values and AsyncTestServerSession.to_values. The values are copies, so a snapshot stays valid after the session it came from is closed.
dict(values) converts it to plain data, all the way down: each TestServerValue becomes a dictionary carrying only the keys its status makes meaningful, so the result is JSON-serializable. dict(session) is the same thing without capturing a snapshot first.
dataclasses.asdict() also works, but keeps every field of every value – including MISSING, which JSON cannot encode.
Attributes
| Name | Type | Description |
|---|---|---|
| is_ok | bool | True when no output or export errored and no fatal error occurred. |
| error | Optional[str] | A summary of the first fatal error, or a count of item errors, or None when is_ok is True. |
| traceback | Optional[str] | The formatted traceback of the first fatal error, or None when there is no error. Per-item tracebacks live on each TestServerValue. |
| inputs | Dict[str, TestServerValue] | Every input the session has received, keyed by input id. |
| outputs | Dict[str, TestServerValue] | Every registered output, keyed by output id, including ones that errored or never rendered. |
| exports | Dict[str, TestServerValue] | Values registered with shiny.testmode.export_test_values, keyed by name. |
See Also
Methods
| Name | Description |
|---|---|
| keys | Return the keys dict(values) produces. |
keys
testserver.TestServerValues.keys()Return the keys dict(values) produces.