forked from pyecharts/pyecharts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_funnel.py
More file actions
33 lines (27 loc) · 998 Bytes
/
test_funnel.py
File metadata and controls
33 lines (27 loc) · 998 Bytes
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
from unittest.mock import patch
from nose.tools import assert_equal
from pyecharts import options as opts
from pyecharts.charts import Funnel
from pyecharts.faker import Faker
@patch("pyecharts.render.engine.write_utf8_html_file")
def test_funnel_base(fake_writer):
c = Funnel().add("商品", [list(z) for z in zip(Faker.choose(), Faker.values())])
c.render()
_, content = fake_writer.call_args[0]
assert_equal(c.theme, "white")
assert_equal(c.renderer, "canvas")
@patch("pyecharts.render.engine.write_utf8_html_file")
def test_funnel_item_base(fake_writer):
funnel_item = [
opts.FunnelItem(name=d[0], value=d[1])
for d in list(zip(Faker.choose(), Faker.values()))
]
c = (
Funnel()
.add("商品", funnel_item)
.set_global_opts(title_opts=opts.TitleOpts(title="Funnel-基本示例"))
)
c.render()
_, content = fake_writer.call_args[0]
assert_equal(c.theme, "white")
assert_equal(c.renderer, "canvas")