Ejemplo n.º 1
0
def test_ts_list_charts_mixin():
    """TimeSeries and ListCharts can set legend options. But not others."""

    opt = {'fields': [{'property': 'foo', 'enabled': False}]}

    ts = TimeSeriesChart()\
            .with_legend_options([FieldOption('foo', enabled=False)])
    assert ts.chart_options['legendOptions'] == opt

    lc = ListChart()\
            .with_legend_options([FieldOption('foo', enabled=False)])
    assert lc.chart_options['legendOptions'] == opt

    with pytest.raises(Exception):
        SingleValueChart().with_legend_options(FieldOption('foo', enabled=False))
def test_list_chart_with_sort_by(sort_by):
    chart = ListChart().with_sort_by(sort_by)
    assert chart.chart_options['sortBy'] == sort_by.value
def test_list_chart_with_maximum_precision():
    chart = ListChart().with_maximum_precision(1)
    assert chart.chart_options['maximumPrecision'] == 1
def test_list_chart_with_refresh_interval():
    chart = ListChart().with_refresh_interval(5)
    assert chart.chart_options['refreshInterval'] == 5