Here are the examples of the python api bokeh.document.locking.UnlockedDocumentProxy taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
3
Source : test_locking.py
with MIT License
from rthorst
with MIT License
from rthorst
def test_next_tick_callback_works():
d = locking.UnlockedDocumentProxy(Document())
assert curdoc() is not d
curdoc_from_cb = []
def cb():
curdoc_from_cb.append(curdoc())
callback_obj = d.add_next_tick_callback(cb)
callback_obj.callback()
assert len(curdoc_from_cb) == 1
assert curdoc_from_cb[0] is d._doc
def cb2(): pass
callback_obj = d.add_next_tick_callback(cb2)
d.remove_next_tick_callback(callback_obj)
def test_other_attrs_raise():
3
Source : test_locking.py
with MIT License
from rthorst
with MIT License
from rthorst
def test_other_attrs_raise():
d = locking.UnlockedDocumentProxy(Document())
assert curdoc() is not d
for attr in (set(dir(d._doc)) - set(dir(d))) | {'foo'}:
with pytest.raises(RuntimeError) as e:
getattr(d, attr)
assert e.value.args[0] == locking.UNSAFE_DOC_ATTR_USAGE_MSG
def test_without_document_lock():