forked from pyecharts/pyecharts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_map_globe.py
31 lines (24 loc) · 974 Bytes
/
test_map_globe.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from unittest.mock import patch
from nose.tools import assert_in, eq_
from example.commons import Faker
from pyecharts.charts import MapGlobe
from pyecharts.globals import CurrentConfig, NotebookType
@patch("pyecharts.render.engine.write_utf8_html_file")
def test_map_base(fake_writer):
c = MapGlobe().add(
"商家A", [list(z) for z in zip(Faker.provinces, Faker.values())], "china"
)
c.render()
_, content = fake_writer.call_args[0]
assert_in("document.createElement('canvas')", content)
eq_(c.theme, "white")
eq_(c.renderer, "canvas")
assert_in("baseTexture", content)
def test_map_globe_in_jupyter():
CurrentConfig.NOTEBOOK_TYPE = NotebookType.JUPYTER_NOTEBOOK
c = MapGlobe().add(
"商家A", [list(z) for z in zip(Faker.provinces, Faker.values())], "china"
)
content = c.render_notebook()._repr_html_()
assert_in("document.createElement('canvas')", content)
assert_in("baseTexture", content)