diff options
| author | Caio Ariede <caio.ariede@gmail.com> | 2019-10-16 09:32:12 -0300 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-11-19 09:34:11 +0100 |
| commit | 555bebe7749ab1a72d5141a00f9ce7a602c72298 (patch) | |
| tree | 54b6414c047c65dd5d4c22e388168d9c9edfb84a /tests/model_fields | |
| parent | aa12cf07c9202e117712abe2621d901dd6dd94b4 (diff) | |
| download | django-555bebe7749ab1a72d5141a00f9ce7a602c72298.tar.gz | |
Fixed #30987 -- Added models.PositiveBigIntegerField.
Diffstat (limited to 'tests/model_fields')
| -rw-r--r-- | tests/model_fields/models.py | 4 | ||||
| -rw-r--r-- | tests/model_fields/test_integerfield.py | 9 | ||||
| -rw-r--r-- | tests/model_fields/test_promises.py | 10 |
3 files changed, 18 insertions, 5 deletions
diff --git a/tests/model_fields/models.py b/tests/model_fields/models.py index 98b32d0c1e..0fd5910339 100644 --- a/tests/model_fields/models.py +++ b/tests/model_fields/models.py @@ -117,6 +117,10 @@ class BigIntegerModel(models.Model): null_value = models.BigIntegerField(null=True, blank=True) +class PositiveBigIntegerModel(models.Model): + value = models.PositiveBigIntegerField() + + class PositiveSmallIntegerModel(models.Model): value = models.PositiveSmallIntegerField() diff --git a/tests/model_fields/test_integerfield.py b/tests/model_fields/test_integerfield.py index 606d71057a..b5517e4c56 100644 --- a/tests/model_fields/test_integerfield.py +++ b/tests/model_fields/test_integerfield.py @@ -6,8 +6,8 @@ from django.db import IntegrityError, connection, models from django.test import SimpleTestCase, TestCase from .models import ( - BigIntegerModel, IntegerModel, PositiveIntegerModel, - PositiveSmallIntegerModel, SmallIntegerModel, + BigIntegerModel, IntegerModel, PositiveBigIntegerModel, + PositiveIntegerModel, PositiveSmallIntegerModel, SmallIntegerModel, ) @@ -182,6 +182,11 @@ class PositiveIntegerFieldTests(IntegerFieldTests): p.save() +class PositiveBigIntegerFieldTests(IntegerFieldTests): + model = PositiveBigIntegerModel + documented_range = (0, 9223372036854775807) + + class ValidationTests(SimpleTestCase): class Choices(models.IntegerChoices): diff --git a/tests/model_fields/test_promises.py b/tests/model_fields/test_promises.py index afbf36651a..b31b679f51 100644 --- a/tests/model_fields/test_promises.py +++ b/tests/model_fields/test_promises.py @@ -4,9 +4,9 @@ from decimal import Decimal from django.db.models.fields import ( AutoField, BinaryField, BooleanField, CharField, DateField, DateTimeField, DecimalField, EmailField, FilePathField, FloatField, GenericIPAddressField, - IntegerField, IPAddressField, NullBooleanField, PositiveIntegerField, - PositiveSmallIntegerField, SlugField, SmallIntegerField, TextField, - TimeField, URLField, + IntegerField, IPAddressField, NullBooleanField, PositiveBigIntegerField, + PositiveIntegerField, PositiveSmallIntegerField, SlugField, + SmallIntegerField, TextField, TimeField, URLField, ) from django.db.models.fields.files import FileField, ImageField from django.test import SimpleTestCase @@ -97,6 +97,10 @@ class PromiseTest(SimpleTestCase): lazy_func = lazy(lambda: 1, int) self.assertIsInstance(PositiveSmallIntegerField().get_prep_value(lazy_func()), int) + def test_PositiveBigIntegerField(self): + lazy_func = lazy(lambda: 1, int) + self.assertIsInstance(PositiveBigIntegerField().get_prep_value(lazy_func()), int) + def test_SlugField(self): lazy_func = lazy(lambda: 'slug', str) self.assertIsInstance(SlugField().get_prep_value(lazy_func()), str) |
