diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-07-20 14:22:00 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-07-22 09:29:54 +0200 |
| commit | 3cb2457f46b3e40ff6b6acffcb3fd44cbea091e5 (patch) | |
| tree | 68e43a061f1a7a122c02d5c5b39586b32959a9dc /tests | |
| parent | cacd845996d1245f6aed257bff5f748f46206d3f (diff) | |
[py3] Replaced basestring by six.string_types.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/modeltests/field_subclassing/fields.py | 3 | ||||
| -rw-r--r-- | tests/modeltests/serializers/tests.py | 3 | ||||
| -rw-r--r-- | tests/regressiontests/forms/tests/fields.py | 3 | ||||
| -rw-r--r-- | tests/regressiontests/i18n/commands/tests.py | 4 | ||||
| -rw-r--r-- | tests/regressiontests/staticfiles_tests/tests.py | 3 |
5 files changed, 11 insertions, 5 deletions
diff --git a/tests/modeltests/field_subclassing/fields.py b/tests/modeltests/field_subclassing/fields.py index b9987c0fab..553b031de3 100644 --- a/tests/modeltests/field_subclassing/fields.py +++ b/tests/modeltests/field_subclassing/fields.py @@ -4,6 +4,7 @@ import json from django.db import models from django.utils.encoding import force_unicode +from django.utils import six class Small(object): @@ -66,7 +67,7 @@ class JSONField(models.TextField): if not value: return None - if isinstance(value, basestring): + if isinstance(value, six.string_types): value = json.loads(value) return value diff --git a/tests/modeltests/serializers/tests.py b/tests/modeltests/serializers/tests.py index 13cf1e7e17..73a3aa3e7a 100644 --- a/tests/modeltests/serializers/tests.py +++ b/tests/modeltests/serializers/tests.py @@ -10,6 +10,7 @@ from django.conf import settings from django.core import serializers from django.db import transaction, connection from django.test import TestCase, TransactionTestCase, Approximate +from django.utils import six from django.utils import unittest from .models import (Category, Author, Article, AuthorProfile, Actor, Movie, @@ -461,7 +462,7 @@ else: # yaml.safe_load will return non-string objects for some # of the fields we are interested in, this ensures that # everything comes back as a string - if isinstance(field_value, basestring): + if isinstance(field_value, six.string_types): ret_list.append(field_value) else: ret_list.append(str(field_value)) diff --git a/tests/regressiontests/forms/tests/fields.py b/tests/regressiontests/forms/tests/fields.py index 12eb016c6e..feb2ade458 100644 --- a/tests/regressiontests/forms/tests/fields.py +++ b/tests/regressiontests/forms/tests/fields.py @@ -35,10 +35,11 @@ from decimal import Decimal from django.core.files.uploadedfile import SimpleUploadedFile from django.forms import * from django.test import SimpleTestCase +from django.utils import six def fix_os_paths(x): - if isinstance(x, basestring): + if isinstance(x, six.string_types): return x.replace('\\', '/') elif isinstance(x, tuple): return tuple(fix_os_paths(list(x))) diff --git a/tests/regressiontests/i18n/commands/tests.py b/tests/regressiontests/i18n/commands/tests.py index 38e8af1d0d..e00ef72d59 100644 --- a/tests/regressiontests/i18n/commands/tests.py +++ b/tests/regressiontests/i18n/commands/tests.py @@ -2,13 +2,15 @@ import os import re from subprocess import Popen, PIPE +from django.utils import six + can_run_extraction_tests = False can_run_compilation_tests = False def find_command(cmd, path=None, pathext=None): if path is None: path = os.environ.get('PATH', []).split(os.pathsep) - if isinstance(path, basestring): + if isinstance(path, six.string_types): path = [path] # check if there are funny path extensions for executables, e.g. Windows if pathext is None: diff --git a/tests/regressiontests/staticfiles_tests/tests.py b/tests/regressiontests/staticfiles_tests/tests.py index 812a80a583..e05729cf7f 100644 --- a/tests/regressiontests/staticfiles_tests/tests.py +++ b/tests/regressiontests/staticfiles_tests/tests.py @@ -20,6 +20,7 @@ from django.test.utils import override_settings from django.utils.encoding import smart_unicode from django.utils.functional import empty from django.utils._os import rmtree_errorhandler +from django.utils import six from django.contrib.staticfiles import finders, storage @@ -83,7 +84,7 @@ class BaseStaticFilesTestCase(object): self.assertRaises(IOError, self._get_file, filepath) def render_template(self, template, **kwargs): - if isinstance(template, basestring): + if isinstance(template, six.string_types): template = loader.get_template_from_string(template) return template.render(Context(kwargs)).strip() |
