import pytest from pytest import mark, raises from bottle import template @mark.parametrize('expected, params', [ ("""
""", { "id": "select-id", "label": "Choose: ", "name": "select-name", "hint": "hint", "multiple": True, "children": [{"optgroup": "Group", "options": [ { "value": "val1-to-backend", "display": "val1", }, { "value": "val2", "disabled": True, }, ]}, ]}), ("""
""",{ "id": "select-unit-id", "name": "unit", "children": [{ "options": [ { "value": "val1", }, { "value": "val2", "selected": True, }, ]}, ]}), ("""
""",{ "id": "select-id", "label": "Choose: ", "name": "select-name", "hint": "hint", "multiple": True, "children": [ {"optgroup": "Group", "options": [ { "value": "val1-to-backend", "display": "val1", }, { "value": "val2", "disabled": True, } ]}, { "options": [ { "value": "val1", }, { "value": "val2", "selected": True, }, ]}, ]}) ]) def test_select_render_exact(expected, params): assert template('select', **params) == expected