Exemplo n.º 1
0
def test_view_merged_compute(default_table, override_table, context):
    view = View()
    view.name = Simple('name')
    view.magnitude = FloatRange('magnitude')
    view.target = FormattedString(
            'target', format_string='{color}_{series}',
            format_parameters={'color': ['RED', 'GREEN', 'BLUE'], 'series': ['00']})

    view.add_table(default_table)
    view.add_table(override_table)

    result = view.compute(**context)
    assert result['name'] == 'Bar'
    assert -0.8 <= result['magnitude'] <= -0.5
    assert result['target'] in ('BLUE_00', 'GREEN_00')
Exemplo n.º 2
0
def test_view_add_table(default_table):
    view = View()
    view.add_table(default_table)

    assert default_table in view._tables