# 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.fields import IntegerField
from wtforms.fields import StringField
from wtforms.form import BaseForm
from wtforms.form import Form
from wtforms.meta import DefaultMeta
from wtforms.validators import DataRequired
from wtforms.validators import ValidationError
        assert form.data == {"test": "foo"}

    def test_errors_proxy(self):
        form = self.get_form()
        form.process(test="foobar")
        form.validate()
        assert form.errors == {}

        form = self.get_form()
        form.process()
        form.validate()
        assert form.errors == {"test": ["error"]}

    def test_contains(self):
        form = self.get_form()
        assert "test" in form
        assert "abcd" not in form

    def test_field_removal(self):
        form = self.get_form()
        del form["test"]
        with pytest.raises(AttributeError):
            form.test
        assert "test" not in form

    def test_field_adding(self):
        form = self.get_form()
        assert len(list(form)) == 1
        form["foo"] = StringField()
        assert len(list(form)) == 2

# 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/test_form.py
import pytest
from tests.common import DummyPostData
from wtforms.fields import IntegerField
from wtforms.fields import StringField
from wtforms.form import BaseForm
from wtforms.form import Form
from wtforms.meta import DefaultMeta
from wtforms.validators import DataRequired
from wtforms.validators import ValidationError

        assert form.data == {"test": "foo"}

    def test_errors_proxy(self):
        form = self.get_form()
        form.process(test="foobar")
        form.validate()
        assert form.errors == {}

        form = self.get_form()
        form.process()
        form.validate()
        assert form.errors == {"test": ["error"]}

    def test_contains(self):
        form = self.get_form()
        assert "test" in form
        assert "abcd" not in form

    def test_field_removal(self):
        form = self.get_form()
        del form["test"]
        with pytest.raises(AttributeError):
            form.test
        assert "test" not in form

    def test_field_adding(self):
        form = self.get_form()
        assert len(list(form)) == 1
        form["foo"] = StringField()
        assert len(list(form)) == 2

        form.process(DummyPostData(foo=["hello"]))