Skip to content

Commit

Permalink
update test code
Browse files Browse the repository at this point in the history
  • Loading branch information
sunhailin committed Oct 18, 2024
1 parent ab168ab commit f37241a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/test_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from pyecharts.charts import Bar, Line, Page
from pyecharts.commons.utils import OrderedSet
from pyecharts.globals import ThemeType
from pyecharts.globals import ThemeType, CurrentConfig
from pyecharts.components import Table
from pyecharts import options as opts
from pyecharts.faker import Faker
Expand Down Expand Up @@ -173,3 +173,11 @@ def test_page_no_cfg_dict_or_file(self):
with self.assertRaises(ValueError):
page = Page()
page.save_resize_html()

def test_page_with_is_embed_js(self):
page = Page(layout=Page.SimplePageLayout, is_embed_js=True)
# Embedded JavaScript
content = page.render_embed()
self.assertNotIn(
CurrentConfig.ONLINE_HOST, content, "Embedding JavaScript fails"
)
15 changes: 15 additions & 0 deletions test/test_series_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

from pyecharts.commons.utils import remove_key_with_none_value
from pyecharts.options.series_options import (
AnimationOpts,
LabelOpts,
ItemStyleOpts,
MarkPointItem,
MarkLineItem,
MarkLineOpts,
MarkAreaItem,
MarkAreaOpts,
MarkPointOpts,
MinorTickOpts,
MinorSplitLineOpts,
TreeMapBreadcrumbOpts,
Expand Down Expand Up @@ -174,3 +177,15 @@ def test_minor_split_line_options_remove_none(self):
def test_area_color_in_item_styles(self):
op = ItemStyleOpts(area_color="red")
self.assertEqual(op.opts["areaColor"], "red")

def test_mark_point_opts_with_animation(self):
op = MarkPointOpts(animation_opts=AnimationOpts(animation=True))
self.assertEqual(op.opts["animation"], True)

def test_mark_line_opts_with_animation(self):
op = MarkLineOpts(animation_opts=AnimationOpts(animation=True))
self.assertEqual(op.opts["animation"], True)

def test_mark_area_opts_with_animation(self):
op = MarkAreaOpts(animation_opts=AnimationOpts(animation=True))
self.assertEqual(op.opts["animation"], True)

0 comments on commit f37241a

Please sign in to comment.