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


import pytest
from tests.common import DummyPostData
from wtforms import validators
from wtforms.fields import FormField
from wtforms.fields import StringField
from wtforms.form import Form
    @property
    def a(self):
        return AttrDict(self.a_) if getattr(self, "a_", None) else AttrDict()

    @a.setter
    def a(self, value):
        self.a_ = vars(value)


def make_form(name="F", **fields):
    return type(str(name), (Form,), fields)


@pytest.fixture
def F1():
    F = make_form(
        a=StringField(validators=[validators.DataRequired()]), b=StringField()
    )
    return make_form("F1", a=FormField(F))


@pytest.fixture
def F2():
    F = make_form(
        a=StringField(validators=[validators.DataRequired()]), b=StringField()
    )
    return make_form("F2", a=FormField(F, separator="::"))


def test_formdata(F1):

# 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_form.py
import pytest
from tests.common import DummyPostData
from wtforms import validators
from wtforms.fields import FormField
from wtforms.fields import StringField
from wtforms.form import Form

    @property
    def a(self):
        return AttrDict(self.a_) if getattr(self, "a_", None) else AttrDict()

    @a.setter
    def a(self, value):
        self.a_ = vars(value)


def make_form(name="F", **fields):
    return type(str(name), (Form,), fields)


@pytest.fixture
def F1():
    F = make_form(
        a=StringField(validators=[validators.DataRequired()]), b=StringField()
    )
    return make_form("F1", a=FormField(F))


@pytest.fixture
def F2():
    F = make_form(
        a=StringField(validators=[validators.DataRequired()]), b=StringField()
    )
    return make_form("F2", a=FormField(F, separator="::"))


def test_formdata(F1):

    form = F1(DummyPostData({"a-a": ["moo"]}))