diff options
| author | Claude Paroz <claude@2xlibre.net> | 2016-12-29 16:27:49 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2017-01-18 20:18:46 +0100 |
| commit | 7b2f2e74adb36a4334e83130f6abc2f79d395235 (patch) | |
| tree | 313387ba6a6f1311b43cf5fb4f2576d2d6c4f805 /tests/model_fields | |
| parent | f6acd1d271122d66de8061e75ae26137ddf02658 (diff) | |
Refs #23919 -- Removed six.<various>_types usage
Thanks Tim Graham and Simon Charette for the reviews.
Diffstat (limited to 'tests/model_fields')
| -rw-r--r-- | tests/model_fields/test_foreignkey.py | 3 | ||||
| -rw-r--r-- | tests/model_fields/test_integerfield.py | 7 | ||||
| -rw-r--r-- | tests/model_fields/test_promises.py | 55 |
3 files changed, 31 insertions, 34 deletions
diff --git a/tests/model_fields/test_foreignkey.py b/tests/model_fields/test_foreignkey.py index a521d1aa23..2580e3b650 100644 --- a/tests/model_fields/test_foreignkey.py +++ b/tests/model_fields/test_foreignkey.py @@ -5,7 +5,6 @@ from django.core import checks from django.db import models from django.test import TestCase, skipIfDBFeature from django.test.utils import isolate_apps -from django.utils import six from .models import Bar, FkToChar, Foo, PrimaryKeyCharModel @@ -50,7 +49,7 @@ class ForeignKeyTests(TestCase): def test_related_name_converted_to_text(self): rel_name = Bar._meta.get_field('a').remote_field.related_name - self.assertIsInstance(rel_name, six.text_type) + self.assertIsInstance(rel_name, str) def test_abstract_model_pending_operations(self): """ diff --git a/tests/model_fields/test_integerfield.py b/tests/model_fields/test_integerfield.py index a474e6e602..99d7b1797c 100644 --- a/tests/model_fields/test_integerfield.py +++ b/tests/model_fields/test_integerfield.py @@ -2,7 +2,6 @@ from django.core import validators from django.core.exceptions import ValidationError from django.db import connection, models from django.test import SimpleTestCase, TestCase -from django.utils import six from .models import ( BigIntegerModel, IntegerModel, PositiveIntegerModel, @@ -121,11 +120,11 @@ class IntegerFieldTests(TestCase): def test_types(self): instance = self.model(value=0) - self.assertIsInstance(instance.value, six.integer_types) + self.assertIsInstance(instance.value, int) instance.save() - self.assertIsInstance(instance.value, six.integer_types) + self.assertIsInstance(instance.value, int) instance = self.model.objects.get() - self.assertIsInstance(instance.value, six.integer_types) + self.assertIsInstance(instance.value, int) def test_coercing(self): self.model.objects.create(value='10') diff --git a/tests/model_fields/test_promises.py b/tests/model_fields/test_promises.py index 0dcb1abf3b..afbf36651a 100644 --- a/tests/model_fields/test_promises.py +++ b/tests/model_fields/test_promises.py @@ -10,7 +10,6 @@ from django.db.models.fields import ( ) from django.db.models.fields.files import FileField, ImageField from django.test import SimpleTestCase -from django.utils import six from django.utils.functional import lazy @@ -29,10 +28,10 @@ class PromiseTest(SimpleTestCase): self.assertIsInstance(BooleanField().get_prep_value(lazy_func()), bool) def test_CharField(self): - lazy_func = lazy(lambda: '', six.text_type) - self.assertIsInstance(CharField().get_prep_value(lazy_func()), six.text_type) + lazy_func = lazy(lambda: '', str) + self.assertIsInstance(CharField().get_prep_value(lazy_func()), str) lazy_func = lazy(lambda: 0, int) - self.assertIsInstance(CharField().get_prep_value(lazy_func()), six.text_type) + self.assertIsInstance(CharField().get_prep_value(lazy_func()), str) def test_DateField(self): lazy_func = lazy(lambda: datetime.date.today(), datetime.date) @@ -47,44 +46,44 @@ class PromiseTest(SimpleTestCase): self.assertIsInstance(DecimalField().get_prep_value(lazy_func()), Decimal) def test_EmailField(self): - lazy_func = lazy(lambda: 'mailbox@domain.com', six.text_type) - self.assertIsInstance(EmailField().get_prep_value(lazy_func()), six.text_type) + lazy_func = lazy(lambda: 'mailbox@domain.com', str) + self.assertIsInstance(EmailField().get_prep_value(lazy_func()), str) def test_FileField(self): - lazy_func = lazy(lambda: 'filename.ext', six.text_type) - self.assertIsInstance(FileField().get_prep_value(lazy_func()), six.text_type) + lazy_func = lazy(lambda: 'filename.ext', str) + self.assertIsInstance(FileField().get_prep_value(lazy_func()), str) lazy_func = lazy(lambda: 0, int) - self.assertIsInstance(FileField().get_prep_value(lazy_func()), six.text_type) + self.assertIsInstance(FileField().get_prep_value(lazy_func()), str) def test_FilePathField(self): - lazy_func = lazy(lambda: 'tests.py', six.text_type) - self.assertIsInstance(FilePathField().get_prep_value(lazy_func()), six.text_type) + lazy_func = lazy(lambda: 'tests.py', str) + self.assertIsInstance(FilePathField().get_prep_value(lazy_func()), str) lazy_func = lazy(lambda: 0, int) - self.assertIsInstance(FilePathField().get_prep_value(lazy_func()), six.text_type) + self.assertIsInstance(FilePathField().get_prep_value(lazy_func()), str) def test_FloatField(self): lazy_func = lazy(lambda: 1.2, float) self.assertIsInstance(FloatField().get_prep_value(lazy_func()), float) def test_ImageField(self): - lazy_func = lazy(lambda: 'filename.ext', six.text_type) - self.assertIsInstance(ImageField().get_prep_value(lazy_func()), six.text_type) + lazy_func = lazy(lambda: 'filename.ext', str) + self.assertIsInstance(ImageField().get_prep_value(lazy_func()), str) def test_IntegerField(self): lazy_func = lazy(lambda: 1, int) self.assertIsInstance(IntegerField().get_prep_value(lazy_func()), int) def test_IPAddressField(self): - lazy_func = lazy(lambda: '127.0.0.1', six.text_type) - self.assertIsInstance(IPAddressField().get_prep_value(lazy_func()), six.text_type) + lazy_func = lazy(lambda: '127.0.0.1', str) + self.assertIsInstance(IPAddressField().get_prep_value(lazy_func()), str) lazy_func = lazy(lambda: 0, int) - self.assertIsInstance(IPAddressField().get_prep_value(lazy_func()), six.text_type) + self.assertIsInstance(IPAddressField().get_prep_value(lazy_func()), str) def test_GenericIPAddressField(self): - lazy_func = lazy(lambda: '127.0.0.1', six.text_type) - self.assertIsInstance(GenericIPAddressField().get_prep_value(lazy_func()), six.text_type) + lazy_func = lazy(lambda: '127.0.0.1', str) + self.assertIsInstance(GenericIPAddressField().get_prep_value(lazy_func()), str) lazy_func = lazy(lambda: 0, int) - self.assertIsInstance(GenericIPAddressField().get_prep_value(lazy_func()), six.text_type) + self.assertIsInstance(GenericIPAddressField().get_prep_value(lazy_func()), str) def test_NullBooleanField(self): lazy_func = lazy(lambda: True, bool) @@ -99,25 +98,25 @@ class PromiseTest(SimpleTestCase): self.assertIsInstance(PositiveSmallIntegerField().get_prep_value(lazy_func()), int) def test_SlugField(self): - lazy_func = lazy(lambda: 'slug', six.text_type) - self.assertIsInstance(SlugField().get_prep_value(lazy_func()), six.text_type) + lazy_func = lazy(lambda: 'slug', str) + self.assertIsInstance(SlugField().get_prep_value(lazy_func()), str) lazy_func = lazy(lambda: 0, int) - self.assertIsInstance(SlugField().get_prep_value(lazy_func()), six.text_type) + self.assertIsInstance(SlugField().get_prep_value(lazy_func()), str) def test_SmallIntegerField(self): lazy_func = lazy(lambda: 1, int) self.assertIsInstance(SmallIntegerField().get_prep_value(lazy_func()), int) def test_TextField(self): - lazy_func = lazy(lambda: 'Abc', six.text_type) - self.assertIsInstance(TextField().get_prep_value(lazy_func()), six.text_type) + lazy_func = lazy(lambda: 'Abc', str) + self.assertIsInstance(TextField().get_prep_value(lazy_func()), str) lazy_func = lazy(lambda: 0, int) - self.assertIsInstance(TextField().get_prep_value(lazy_func()), six.text_type) + self.assertIsInstance(TextField().get_prep_value(lazy_func()), str) def test_TimeField(self): lazy_func = lazy(lambda: datetime.datetime.now().time(), datetime.time) self.assertIsInstance(TimeField().get_prep_value(lazy_func()), datetime.time) def test_URLField(self): - lazy_func = lazy(lambda: 'http://domain.com', six.text_type) - self.assertIsInstance(URLField().get_prep_value(lazy_func()), six.text_type) + lazy_func = lazy(lambda: 'http://domain.com', str) + self.assertIsInstance(URLField().get_prep_value(lazy_func()), str) |
