forked from pyecharts/pyecharts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_image.py
More file actions
29 lines (20 loc) · 718 Bytes
/
test_image.py
File metadata and controls
29 lines (20 loc) · 718 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
from unittest.mock import patch
from nose.tools import assert_in
from pyecharts.components import Image
from pyecharts.globals import CurrentConfig, NotebookType
TEST_SRC = "http://test-src.com/test.png"
def _gen_image() -> Image:
image = Image()
image.add(src=TEST_SRC)
return image
@patch("pyecharts.render.engine.write_utf8_html_file")
def test_table_base(fake_writer):
image = _gen_image()
image.render()
_, content = fake_writer.call_args[0]
assert_in(TEST_SRC, content)
def test_table_render_notebook():
CurrentConfig.NOTEBOOK_TYPE = NotebookType.JUPYTER_NOTEBOOK
image = _gen_image()
content = image.render_notebook().__html__()
assert_in(TEST_SRC, content)