def test_dataframe_pane_supports_escape(document, comm): import pandas as pd url = "<a href='https://panel.holoviz.org/'>Panel</a>" df = pd.DataFrame({"url": [url]}) pane = DataFrame(df) # Create pane model = pane.get_root(document, comm=comm) assert pane._models[model.ref['id']][0] is model assert pane.escape assert "<a href='https://panel.holoviz.org/'>Panel</a>" not in model.text pane.escape = False assert "<a href='https://panel.holoviz.org/'>Panel</a>" in model.text # Cleanup pane._cleanup(model) assert pane._models == {}
def test_dataframe_pane_pandas(document, comm): import pandas as pd pane = DataFrame(pd.util.testing.makeDataFrame()) # Create pane model = pane.get_root(document, comm=comm) assert pane._models[model.ref['id']][0] is model assert model.text.startswith('<table') orig_text = model.text # Replace Pane.object pane.object = pd.util.testing.makeMixedDataFrame() assert pane._models[model.ref['id']][0] is model assert model.text.startswith('<table') assert model.text != orig_text # Cleanup pane._cleanup(model) assert pane._models == {}
def test_dataframe_pane_streamz(document, comm): from streamz.dataframe import Random sdf = Random(interval='200ms', freq='50ms') pane = DataFrame(sdf) assert pane._stream is None # Create pane model = pane.get_root(document, comm=comm) assert pane._stream is not None assert pane._models[model.ref['id']][0] is model assert model.text == '' # Replace Pane.object pane.object = sdf.x assert pane._models[model.ref['id']][0] is model assert model.text == '' # Cleanup pane._cleanup(model) assert pane._stream is None assert pane._models == {}