# 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.fields import BooleanField
from wtforms.form import Form



class AttrDict:
    def __init__(self, *args, **kw):
        self.__dict__.update(*args, **kw)


class BoringForm(Form):
    bool1 = BooleanField()
    bool2 = BooleanField(default=True, false_values=())


obj = AttrDict(bool1=None, bool2=True)


def test_defaults():
    # Test with no post data to make sure defaults work
    form = BoringForm()
    assert form.bool1.raw_data is None
    assert form.bool1.data is False
    assert form.bool2.data is True


def test_rendering():

# 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_boolean.py
from tests.common import DummyPostData
from wtforms.fields import BooleanField
from wtforms.form import Form




class AttrDict:
    def __init__(self, *args, **kw):
        self.__dict__.update(*args, **kw)


class BoringForm(Form):
    bool1 = BooleanField()
    bool2 = BooleanField(default=True, false_values=())


obj = AttrDict(bool1=None, bool2=True)


def test_defaults():
    # Test with no post data to make sure defaults work
    form = BoringForm()
    assert form.bool1.raw_data is None
    assert form.bool1.data is False
    assert form.bool2.data is True


def test_rendering():

    form = BoringForm(DummyPostData(bool2="x"))