# Path: tests/common.py
# class DummyPostData(dict):
#     def getlist(self, key):
#         v = self[key]
#         if not isinstance(v, (list, tuple)):
#             v = [v]
#         return v


from tests.common import DummyPostData
from wtforms import validators
from wtforms.fields import RadioField
from wtforms.form import Form
        return [("a", "hello"), ("b", "bye")]

    class F(Form):
        a = RadioField(choices=choices, default="a")

    form = F()
    assert form.a.data == "a"
    assert form.a() == (
        '<ul id="a">'
        '<li><input checked id="a-0" name="a" type="radio" value="a"> '
        '<label for="a-0">hello</label></li>'
        '<li><input id="a-1" name="a" type="radio" value="b"> '
        '<label for="a-1">bye</label></li>'
        "</ul>"
    )


def test_required_flag():
    form = F()
    assert form.c() == (
        '<ul id="c">'
        '<li><input id="c-0" name="c" required type="radio" value="a"> '
        '<label for="c-0">Item 1</label></li>'
        '<li><input id="c-1" name="c" required type="radio" value="b"> '
        '<label for="c-1">Item 2</label></li>'
        "</ul>"
    )


def test_required_validator():

# Path: tests/common.py
# class DummyPostData(dict):
#     def getlist(self, key):
#         v = self[key]
#         if not isinstance(v, (list, tuple)):
#             v = [v]
#         return v


# Path: tests/fields/test_radio.py
from tests.common import DummyPostData
from wtforms import validators
from wtforms.fields import RadioField
from wtforms.form import Form

        return [("a", "hello"), ("b", "bye")]

    class F(Form):
        a = RadioField(choices=choices, default="a")

    form = F()
    assert form.a.data == "a"
    assert form.a() == (
        '<ul id="a">'
        '<li><input checked id="a-0" name="a" type="radio" value="a"> '
        '<label for="a-0">hello</label></li>'
        '<li><input id="a-1" name="a" type="radio" value="b"> '
        '<label for="a-1">bye</label></li>'
        "</ul>"
    )


def test_required_flag():
    form = F()
    assert form.c() == (
        '<ul id="c">'
        '<li><input id="c-0" name="c" required type="radio" value="a"> '
        '<label for="c-0">Item 1</label></li>'
        '<li><input id="c-1" name="c" required type="radio" value="b"> '
        '<label for="c-1">Item 2</label></li>'
        "</ul>"
    )


def test_required_validator():

    form = F(DummyPostData(b=1, c="a"))