# Path: webtools/formdata/base.py
# class FormData(FormDataBase, metaclass=FormDataMeta):
#     pass
# 
# Path: webtools/formdata/field.py
# class Field(object):
#     def __init__(self, datatype, widget=None, required=True, default=None):
#         assert isinstance(datatype, data_types.Type), "datatype must be a instance of Type"
#         self.datatype = datatype
#         self.default = default
#         self.required = required
#         self.widget = widget
# 
#         if self.widget:
#             if isinstance(self.widget, type):
#                 self.widget = self.widget()
#             assert isinstance(self.widget, Widget), "widget must be a instance of Widget"
# 
#     def clean(self, name, formdata):
#         raw_value = formdata.get_argument(name)
#         if raw_value:
#             return self.datatype.to_python(raw_value, self)
#         else:
#             if not self.required:
#                 return self.default
#             raise ValidateError("this field is required")
# 
# Path: webtools/formdata/data_types.py
# class Type(object):
# class Integer(Type):
# class Unicode(Type):
# class MultipleUnicode(Type):
# class MultipleInteger(Type):
# class Date(Type):
# class DateTime(Type):
#     def to_python(self, value, field):
#     def from_python(self, value):
#     def to_python(self, value, field):
#     def to_python(self, value, field):
#     def to_python(self, value, field):
# 
# Path: webtools/formdata/widgets.py
# class Widget(object):
# class InputText(Widget):
# class Textarea(Widget):
#     def __init__(self, attrs={}):
#     def set_field(self, field):
#     def render(self, name, prefixed_name, value):
#     def attrs_to_str(self, attrs):
#     def __call__(self, name, prefixed_name, value):
#     def render(self, name, prefixed_name, value):
#     def render(self, name, prefixed_name, value):


from unittest import TestCase
from webtools.formdata.base import FormData
from webtools.formdata.field import Field
from webtools.formdata import data_types as types
from webtools.formdata import widgets

class HandlerMock(object):
    def __init__(self, arguments):
        self.arguments = arguments

    def get_arguments(self, name):
        if name not in self.arguments:
            return []

        value = self.arguments[name]
        if not isinstance(value, (list, tuple)):
            value = [value]

        return value




class TestForm1(FormData):
    field1 = Field(types.Unicode())

# Path: webtools/formdata/base.py
# class FormData(FormDataBase, metaclass=FormDataMeta):
#     pass
# 
# Path: webtools/formdata/field.py
# class Field(object):
#     def __init__(self, datatype, widget=None, required=True, default=None):
#         assert isinstance(datatype, data_types.Type), "datatype must be a instance of Type"
#         self.datatype = datatype
#         self.default = default
#         self.required = required
#         self.widget = widget
# 
#         if self.widget:
#             if isinstance(self.widget, type):
#                 self.widget = self.widget()
#             assert isinstance(self.widget, Widget), "widget must be a instance of Widget"
# 
#     def clean(self, name, formdata):
#         raw_value = formdata.get_argument(name)
#         if raw_value:
#             return self.datatype.to_python(raw_value, self)
#         else:
#             if not self.required:
#                 return self.default
#             raise ValidateError("this field is required")
# 
# Path: webtools/formdata/data_types.py
# class Type(object):
# class Integer(Type):
# class Unicode(Type):
# class MultipleUnicode(Type):
# class MultipleInteger(Type):
# class Date(Type):
# class DateTime(Type):
#     def to_python(self, value, field):
#     def from_python(self, value):
#     def to_python(self, value, field):
#     def to_python(self, value, field):
#     def to_python(self, value, field):
# 
# Path: webtools/formdata/widgets.py
# class Widget(object):
# class InputText(Widget):
# class Textarea(Widget):
#     def __init__(self, attrs={}):
#     def set_field(self, field):
#     def render(self, name, prefixed_name, value):
#     def attrs_to_str(self, attrs):
#     def __call__(self, name, prefixed_name, value):
#     def render(self, name, prefixed_name, value):
#     def render(self, name, prefixed_name, value):


# Path: tests/test_formdata.py
from unittest import TestCase
from webtools.formdata.base import FormData
from webtools.formdata.field import Field
from webtools.formdata import data_types as types
from webtools.formdata import widgets


class HandlerMock(object):
    def __init__(self, arguments):
        self.arguments = arguments

    def get_arguments(self, name):
        if name not in self.arguments:
            return []

        value = self.arguments[name]
        if not isinstance(value, (list, tuple)):
            value = [value]

        return value




class TestForm1(FormData):
    field1 = Field(types.Unicode())

    field2 = Field(types.Integer())