1 6
from collections import OrderedDict
2

3 6
from bokeh.models import Div
4

5 6
from panel.io.notebook import render_mimebundle
6 6
from panel.pane import PaneBase
7 6
from panel.util import get_method_owner, abbreviated_repr
8

9

10 6
def test_get_method_owner_class():
11 6
    assert get_method_owner(PaneBase.get_pane_type) is PaneBase
12

13

14 6
def test_get_method_owner_instance():
15 6
    div = Div()
16 6
    assert get_method_owner(div.update) is div
17

18

19 6
def test_render_mimebundle(document, comm):
20 6
    div = Div()
21 6
    data, metadata = render_mimebundle(div, document, comm)
22

23 6
    assert metadata == {'application/vnd.holoviews_exec.v0+json': {'id': div.ref['id']}}
24 6
    assert 'application/vnd.holoviews_exec.v0+json' in data
25 6
    assert 'text/html' in data
26 6
    assert data['application/vnd.holoviews_exec.v0+json'] == ''
27

28

29 6
def test_abbreviated_repr_dict():
30 6
    assert abbreviated_repr({'key': 'some really, really long string'}) == "{'key': 'some really, ...}"
31

32

33 6
def test_abbreviated_repr_list():
34 6
    assert abbreviated_repr(['some really, really long string']) == "['some really, ...]"
35

36

37 6
def test_abbreviated_repr_ordereddict():
38 6
    assert (abbreviated_repr(OrderedDict([('key', 'some really, really long string')]))
39
            == "OrderedDict([('key', ...])")

Read our documentation on viewing source code .

Loading