mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 04:50:12 +03:00
add failing test. adding a max_length argument to an IntegerField should be valid
This commit is contained in:
parent
201e7eaa4b
commit
15673208a1
|
@ -609,3 +609,21 @@ class TestSerializerMetaClass(TestCase):
|
||||||
str(exception),
|
str(exception),
|
||||||
"Cannot set both 'fields' and 'exclude'."
|
"Cannot set both 'fields' and 'exclude'."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class MaxIntLengthModel(models.Model):
|
||||||
|
count = models.IntegerField()
|
||||||
|
|
||||||
|
|
||||||
|
class TestIntegerMaxLength(TestCase):
|
||||||
|
def test_max_length(self):
|
||||||
|
class BasicModelSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = MaxIntLengthModel
|
||||||
|
fields = ('count',)
|
||||||
|
|
||||||
|
expected = dedent("""
|
||||||
|
BasicModelSerializer():
|
||||||
|
count = IntegerField()
|
||||||
|
""")
|
||||||
|
self.assertEqual(repr(BasicModelSerializer()), expected)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user