Esempio n. 1
0
    def test__hinted_value_with_hint_ColumnDataChanged(self) -> None:
        from bokeh.document.events import ColumnDataChangedEvent

        prop = bcpc.ColumnData(String, Seq(Any))
        source = ColumnDataSource(data=dict(foo=[10], bar=[20], baz=[30]))
        hint = ColumnDataChangedEvent("doc", source, "data", cols=["foo"])
        assert prop._hinted_value(source.data, hint) == dict(foo=[10])
Esempio n. 2
0
    def test__hinted_value_with_hint_ColumnsStreamed(self) -> None:
        from bokeh.document.events import ColumnsStreamedEvent

        prop = bcpc.ColumnData(String, Seq(Any))
        source = ColumnDataSource(data=dict(foo=[10], bar=[20], baz=[30]))
        new_data = dict(foo=[11], bar=[21], baz=[31])
        hint = ColumnsStreamedEvent("doc", source, "data", new_data, rollover=10)
        assert prop._hinted_value(source.data, hint) == new_data
Esempio n. 3
0
 def test__hinted_value_without_hint(self) -> None:
     prop = bcpc.ColumnData(String, Seq(Any))
     source = ColumnDataSource(data=dict(foo=[10], bar=[20], baz=[30]))
     assert prop._hinted_value(source.data, None) == source.data
Esempio n. 4
0
 def test_str(self) -> None:
     prop = bcpc.ColumnData(String, Seq(Any))
     assert str(prop) == "ColumnData(String, Seq(Any))"
Esempio n. 5
0
 def test_has_ref(self) -> None:
     prop = bcpc.ColumnData(String, Seq(Any))
     assert not prop.has_ref
Esempio n. 6
0
    def test_init(self) -> None:
        with pytest.raises(TypeError):
            bcpc.ColumnData()

        assert issubclass(bcpc.ColumnData, bcpc.Dict)