# Path: likert_field/forms.py
# class LikertFormField(fields.IntegerField):
#     widget = LikertTextField
#     default_error_messages = {
#         'invalid': _('Please rate how strongly you agree or disagree with '
#                      'the statement.'),
#         'min_value': _(
#             'Ensure your response is greater than or equal to '
#             '%(limit_value)s.'),
#         'max_value': _(
#             'Ensure your response is less than or equal to %(limit_value)s.'),
#     }
# 
#     def __init__(self, min_value=0, *args, **kwargs):
#         kwargs.setdefault('widget', self.widget)
#         kwargs.setdefault('min_value', min_value)
#         super(LikertFormField, self).__init__(*args, **kwargs)
# 
# Path: likert_field/widgets.py
# class LikertTextField(widgets.TextInput):
#     """A Likert field represented as a text input"""
# 
#     def render(self, name, value, attrs=None):
#         """
#         Returns this Widget rendered as HTML, as a Unicode string.
#         """
#         rendered_attrs = {'class': 'likert-field'}
#         if attrs:
#             rendered_attrs.update(attrs)
# 
#         return super(LikertTextField, self).render(name, value, rendered_attrs)


from django.core.exceptions import ValidationError
from django.forms import fields
from django.test import SimpleTestCase
from django.utils.six.moves import xrange
from likert_field.forms import LikertFormField
from likert_field.widgets import LikertTextField



class LikertFormFieldTestCase(SimpleTestCase):

    def test_instantiation(self):
        ff = LikertFormField()
        self.assertIsInstance(ff, fields.Field)

    def test_widget_class(self):
        ff = LikertFormField()
        self.assertIsInstance(ff.widget, LikertTextField)

    def test_min_value(self):
        ff = LikertFormField()
        self.assertEqual(ff.min_value, 0)

    def test_valid_integer_values(self):
        """These are valid responses and should raise no failures"""
        ff = LikertFormField()
        for v in xrange(50+1):
            ff.clean(v)

    def test_valid_integer_string_values(self):
        """These are valid responses and should raise no failures"""
        ff = LikertFormField()
        for v in xrange(50+1):
            ff.clean(str(v))

    def test_invalid_value(self):

# Path: likert_field/forms.py
# class LikertFormField(fields.IntegerField):
#     widget = LikertTextField
#     default_error_messages = {
#         'invalid': _('Please rate how strongly you agree or disagree with '
#                      'the statement.'),
#         'min_value': _(
#             'Ensure your response is greater than or equal to '
#             '%(limit_value)s.'),
#         'max_value': _(
#             'Ensure your response is less than or equal to %(limit_value)s.'),
#     }
# 
#     def __init__(self, min_value=0, *args, **kwargs):
#         kwargs.setdefault('widget', self.widget)
#         kwargs.setdefault('min_value', min_value)
#         super(LikertFormField, self).__init__(*args, **kwargs)
# 
# Path: likert_field/widgets.py
# class LikertTextField(widgets.TextInput):
#     """A Likert field represented as a text input"""
# 
#     def render(self, name, value, attrs=None):
#         """
#         Returns this Widget rendered as HTML, as a Unicode string.
#         """
#         rendered_attrs = {'class': 'likert-field'}
#         if attrs:
#             rendered_attrs.update(attrs)
# 
#         return super(LikertTextField, self).render(name, value, rendered_attrs)


# Path: test_suite/test_forms.py
from django.core.exceptions import ValidationError
from django.forms import fields
from django.test import SimpleTestCase
from django.utils.six.moves import xrange
from likert_field.forms import LikertFormField
from likert_field.widgets import LikertTextField




class LikertFormFieldTestCase(SimpleTestCase):

    def test_instantiation(self):
        ff = LikertFormField()
        self.assertIsInstance(ff, fields.Field)

    def test_widget_class(self):
        ff = LikertFormField()
        self.assertIsInstance(ff.widget, LikertTextField)

    def test_min_value(self):
        ff = LikertFormField()
        self.assertEqual(ff.min_value, 0)

    def test_valid_integer_values(self):
        """These are valid responses and should raise no failures"""
        ff = LikertFormField()
        for v in xrange(50+1):
            ff.clean(v)

    def test_valid_integer_string_values(self):
        """These are valid responses and should raise no failures"""
        ff = LikertFormField()
        for v in xrange(50+1):
            ff.clean(str(v))

    def test_invalid_value(self):

        ff = LikertFormField()