mirror of
https://github.com/pyecharts/pyecharts.git
synced 2026-02-01 17:46:01 +00:00
📚 🔬 document and test the map extension feature
This commit is contained in:
parent
4456958755
commit
574b8bfc31
22
docs/map-extension-architecture.uml
Normal file
22
docs/map-extension-architecture.uml
Normal file
@ -0,0 +1,22 @@
|
||||
@startuml
|
||||
package "pyecharts" {
|
||||
[python codes]
|
||||
[jupyter-echarts]
|
||||
[echarts-china-cities-js]
|
||||
}
|
||||
|
||||
[pyecharts-cli]
|
||||
|
||||
cloud "github" {
|
||||
[echarts-countries-js]
|
||||
[echarts-united-kingdom-js]
|
||||
}
|
||||
|
||||
[python codes] --> [jupyter-echarts] : embeds
|
||||
[jupyter-echarts] --> [echarts-china-cities-js] : embeds
|
||||
[python codes] ..> [echarts-countries-js] : reads
|
||||
[python codes] ..> [echarts-united-kingdom-js] : reads
|
||||
[pyecharts-cli] --> [echarts-countries-js] : installs
|
||||
[pyecharts-cli] --> [echarts-united-kingdom-js] : installs
|
||||
|
||||
@enduml
|
||||
@ -9,7 +9,7 @@ JS_EXTENSION_REGISTRY = 'registry.json'
|
||||
|
||||
DEFAULT_TEMPLATE_DIR = get_resource_dir('templates')
|
||||
DEFAULT_ECHARTS_LOCATION = os.path.join(
|
||||
get_resource_dir('templates'), 'js', 'echarts')
|
||||
get_resource_dir('templates'), 'js')
|
||||
|
||||
|
||||
class JsExtension(object):
|
||||
|
||||
11
test/fixtures/registry.json
vendored
Normal file
11
test/fixtures/registry.json
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"JUPYTER_URL": "/nbextensions/test-js",
|
||||
"GITHUB_URL": "https://your.github.io/test-js/test-js",
|
||||
"JUPYTER_ENTRY": "test-js/index",
|
||||
"PINYIN_MAP": {
|
||||
"ABC": "abc"
|
||||
},
|
||||
"FILE_MAP": {
|
||||
"abc": "the_js_file_name"
|
||||
}
|
||||
}
|
||||
28
test/test_js_extension.py
Normal file
28
test/test_js_extension.py
Normal file
@ -0,0 +1,28 @@
|
||||
import os
|
||||
from nose.tools import eq_
|
||||
|
||||
from pyecharts.js_extension import JsExtension
|
||||
|
||||
|
||||
def produce_test_js_extension():
|
||||
registry_path = os.path.join('.', 'fixtures')
|
||||
return JsExtension(registry_path)
|
||||
|
||||
|
||||
def test_get_js_library():
|
||||
test_extension = produce_test_js_extension()
|
||||
print(test_extension.registry)
|
||||
actual = test_extension.get_js_library('abc')
|
||||
eq_(actual, 'the_js_file_name')
|
||||
|
||||
|
||||
def test_get_js_link():
|
||||
test_extension = produce_test_js_extension()
|
||||
actual = test_extension.get_js_link('abc')
|
||||
eq_(actual, '/nbextensions/test-js/the_js_file_name.js')
|
||||
|
||||
|
||||
def test_get_js_link():
|
||||
test_extension = produce_test_js_extension()
|
||||
actual = test_extension.get_js_link('abc')
|
||||
eq_(actual, '/nbextensions/test-js/the_js_file_name.js')
|
||||
Loading…
x
Reference in New Issue
Block a user