Here are the examples of the python api bokeh.core.query.find taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
7 Examples
3
View Source File : test_query.py
License : MIT License
Project Creator : rthorst
License : MIT License
Project Creator : rthorst
def test_type():
for typ, count in typcases.items():
res = list(q.find(plot.references(), dict(type=typ)))
assert len(res) == count
assert all(isinstance(x, typ) for x in res)
def test_tags_with_scalar():
3
View Source File : test_query.py
License : MIT License
Project Creator : rthorst
License : MIT License
Project Creator : rthorst
def test_tags_with_scalar():
cases = {
11: 1,
12: 0,
}
for tag, count in cases.items():
res = list(q.find(plot.references(), dict(tags=tag)))
assert len(res) == count
def test_tags_with_string():
3
View Source File : test_query.py
License : MIT License
Project Creator : rthorst
License : MIT License
Project Creator : rthorst
def test_tags_with_string():
cases = {
"foo": 2,
"bar": 1,
}
for tag, count in cases.items():
res = list(q.find(plot.references(), dict(tags=tag)))
assert len(res) == count
def test_tags_with_seq():
3
View Source File : test_query.py
License : MIT License
Project Creator : rthorst
License : MIT License
Project Creator : rthorst
def test_tags_with_seq():
cases = {
"foo": 2,
"bar": 1,
}
for tag, count in cases.items():
res = list(q.find(plot.references(), dict(tags=[tag])))
assert len(res) == count
res = list(q.find(plot.references(), dict(tags=list(cases.keys()))))
assert len(res) == 2
def test_name():
3
View Source File : test_query.py
License : MIT License
Project Creator : rthorst
License : MIT License
Project Creator : rthorst
def test_name():
cases = {
"myline": Line,
"mycircle": Circle,
"myrect": Rect,
}
for name, typ in cases.items():
res = list(q.find(plot.references(), dict(name=name)))
assert len(res) == 1
assert all(isinstance(x.glyph, typ) for x in res)
def test_in():
3
View Source File : test_query.py
License : MIT License
Project Creator : rthorst
License : MIT License
Project Creator : rthorst
def test_conjuction():
res = list(
q.find(plot.references(), dict(type=Axis, tags="foo"))
)
assert len(res) == 0
res = list(
q.find(plot.references(), dict(type=Range1d, tags="foo"))
)
assert len(res) == 2
res = list(
q.find(plot.references(), dict(type=GlyphRenderer, name="mycircle"))
)
assert len(res) == 1
def test_ops():
3
View Source File : test_query.py
License : MIT License
Project Creator : rthorst
License : MIT License
Project Creator : rthorst
def test_with_context():
res = list(
q.find(plot.references(), {'layout': 'below'}, {'plot': plot})
)
assert len(res) == 1
res = list(
q.find(plot.references(), {'select': 'below'}, {'plot': plot})
)
assert len(res) == 0
#-----------------------------------------------------------------------------
# Private API
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Code
#-----------------------------------------------------------------------------