forked from pyecharts/pyecharts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_map3d.py
More file actions
58 lines (52 loc) · 1.77 KB
/
test_map3d.py
File metadata and controls
58 lines (52 loc) · 1.77 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from unittest.mock import patch
from nose.tools import assert_in
from pyecharts import options as opts
from pyecharts.charts import Map3D
from pyecharts.faker import Faker
from pyecharts.globals import ChartType
@patch("pyecharts.render.engine.write_utf8_html_file")
def test_map3d_base(fake_writer):
c = (
Map3D()
.add_schema()
.add(
"商家A",
[list(z) for z in zip(Faker.provinces, Faker.values())],
maptype="china",
)
)
c.render()
_, content = fake_writer.call_args[0]
assert_in("map3D", content)
@patch("pyecharts.render.engine.write_utf8_html_file")
def test_map3d_schema(fake_writer):
c = (
Map3D()
.add_schema(
itemstyle_opts=opts.ItemStyleOpts(),
map3d_label=opts.Map3DLabelOpts(),
light_opts=opts.Map3DLightOpts(),
view_control_opts=opts.Map3DViewControlOpts(),
post_effect_opts=opts.Map3DPostEffectOpts(),
realistic_material_opts=opts.Map3DRealisticMaterialOpts(),
lambert_material_opts=opts.Map3DLambertMaterialOpts(),
color_material_opts=opts.Map3DColorMaterialOpts(),
)
.add(
series_name="商家A",
data_pair=[list(z) for z in zip(Faker.provinces, Faker.values())],
maptype="china",
type_=ChartType.LINES3D,
effect=opts.Lines3DEffectOpts(),
)
)
c.render()
_, content = fake_writer.call_args[0]
assert_in("itemStyle", content)
assert_in("label", content)
assert_in("light", content)
assert_in("viewControl", content)
assert_in("postEffect", content)
assert_in("realisticMaterial", content)
assert_in("lambertMaterial", content)
assert_in("colorMaterial", content)