Example #1
0
def test_custom_local_jshost():
    target_config = PyEchartsConfig(jshost='/static/js/')
    eq_('/static/js', target_config.jshost)
    eq_('/static/js', target_config.get_current_jshost_for_script())
    eq_('/static/js', target_config.get_current_jshost_for_jupyter())
    eq_('/static/js/echarts',
        target_config.get_current_jshost_for_jupyter('/static/js/echarts'))

    assert not target_config.js_embed

    target_config.force_js_embed = True

    assert target_config.js_embed
Example #2
0
def test_pyecharts_remote_jshost():
    target_config = PyEchartsConfig(jshost=DEFAULT_HOST)
    eq_('https://chfw.github.io/jupyter-echarts/echarts', target_config.jshost)
    eq_('https://chfw.github.io/jupyter-echarts/echarts',
        target_config.get_current_jshost_for_script())
    eq_('https://chfw.github.io/jupyter-echarts/echarts',
        target_config.get_current_jshost_for_jupyter())
    eq_('/static/js/echarts',
        target_config.get_current_jshost_for_jupyter('/static/js/echarts'))

    assert target_config.js_embed

    target_config.force_js_embed = True

    assert target_config.js_embed
Example #3
0
def test_custom_remote_jshost():
    target_config = PyEchartsConfig(
        jshost='https://cdn.bootcss.com/echarts/3.7.2/')
    eq_('https://cdn.bootcss.com/echarts/3.7.2', target_config.jshost)
    eq_('https://cdn.bootcss.com/echarts/3.7.2',
        target_config.get_current_jshost_for_script())
    eq_('https://cdn.bootcss.com/echarts/3.7.2',
        target_config.get_current_jshost_for_jupyter())
    eq_('/static/js/echarts',
        target_config.get_current_jshost_for_jupyter('/static/js/echarts'))

    assert not target_config.js_embed

    target_config.force_js_embed = True

    assert target_config.js_embed
Example #4
0
def test_with_default_value():
    target_config = PyEchartsConfig()
    eq_(SCRIPT_LOCAL_JSHOST, target_config.jshost)
    eq_(SCRIPT_LOCAL_JSHOST, target_config.get_current_jshost_for_script())
    eq_(JUPYTER_LOCAL_JSHOST, target_config.get_current_jshost_for_jupyter())
    eq_('http://demo',
        target_config.get_current_jshost_for_script('http://demo'))

    assert target_config.js_embed

    target_config.force_js_embed = True

    assert target_config.js_embed