mirror of
https://github.com/pyecharts/pyecharts.git
synced 2025-12-08 20:59:23 +00:00
25 lines
570 B
Python
25 lines
570 B
Python
import unittest
|
|
|
|
from pyecharts.charts import Bar, Line
|
|
from pyecharts.charts.mixins import CompositeMixin
|
|
|
|
|
|
class CustomCompositeChart(CompositeMixin):
|
|
def __init__(self):
|
|
self._charts: list = []
|
|
|
|
def add(self, chart, tab_name):
|
|
chart.tab_name = tab_name
|
|
self._charts.append(chart)
|
|
return self
|
|
|
|
|
|
class TestMixins(unittest.TestCase):
|
|
def test_composite_mixin_len(self):
|
|
b_1 = Bar()
|
|
b_2 = Line()
|
|
c = CustomCompositeChart()
|
|
c.add(b_1, "bar")
|
|
c.add(b_2, "line")
|
|
assert len(c) == 2
|