massdash.testing.BokehSnapshotExtension
- class massdash.testing.BokehSnapshotExtension
Bases:
SingleFileSnapshotExtensionHandles Bokeh Snapshots. Snapshots are stored as html files and the bokeh .json output from the html files are compared.
- static compare_json(json1, json2)
Compare two bokeh json objects. This function acts recursively
- Parameters:
json1 – first object
json2 – second object
- Returns:
True if the objects are equal, False otherwise
- Return type:
bool
- extract_bokeh_json(html) <module 'json' from '/home/docs/.asdf/installs/python/3.11.12/lib/python3.11/json/__init__.py'>
Extract the bokeh json from the html file.
- Parameters:
html – string or bytes containing the html data
- Returns:
bokeh json found in the html
- Return type:
json
- matches(*, serialized_data, snapshot_data)
Determine if the serialized data matches the snapshot data.
- Parameters:
serialized_data – Data produced by the test (bytes)
snapshot_data – Saved data from a previous test run (bytes)
- serialize(data: Any, **kwargs: Any) bytes
Serialize the bokeh plot as bytes containing HTML content
- Parameters:
data (SerializableData) – Data to serialize
- Returns:
HTML content as bytes
- Return type:
bytes