diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-07-21 10:00:10 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-08-07 12:00:22 +0200 |
| commit | c5ef65bcf324f4c90b53be90f4aec069a68e8c59 (patch) | |
| tree | bb9a4988fbae4e7366cc578ca845c49003cdcd64 /tests/regressiontests/cache | |
| parent | ee191715eae73362768184aa95206cf61bac5d38 (diff) | |
[py3] Ported django.utils.encoding.
* Renamed smart_unicode to smart_text (but kept the old name under
Python 2 for backwards compatibility).
* Renamed smart_str to smart_bytes.
* Re-introduced smart_str as an alias for smart_text under Python 3
and smart_bytes under Python 2 (which is backwards compatible).
Thus smart_str always returns a str objects.
* Used the new smart_str in a few places where both Python 2 and 3
want a str.
Diffstat (limited to 'tests/regressiontests/cache')
| -rw-r--r-- | tests/regressiontests/cache/tests.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/regressiontests/cache/tests.py b/tests/regressiontests/cache/tests.py index 264ef74abd..8fc749aaa2 100644 --- a/tests/regressiontests/cache/tests.py +++ b/tests/regressiontests/cache/tests.py @@ -28,7 +28,7 @@ from django.test.utils import (get_warnings_state, restore_warnings_state, from django.utils import timezone, translation, unittest from django.utils.cache import (patch_vary_headers, get_cache_key, learn_cache_key, patch_cache_control, patch_response_headers) -from django.utils.encoding import force_unicode +from django.utils.encoding import force_text from django.views.decorators.cache import cache_page from .models import Poll, expensive_calculation @@ -1307,7 +1307,7 @@ class CacheI18nTest(TestCase): request = self._get_request() # This is tightly coupled to the implementation, # but it's the most straightforward way to test the key. - tz = force_unicode(timezone.get_current_timezone_name(), errors='ignore') + tz = force_text(timezone.get_current_timezone_name(), errors='ignore') tz = tz.encode('ascii', 'ignore').replace(' ', '_') response = HttpResponse() key = learn_cache_key(request, response) @@ -1319,7 +1319,7 @@ class CacheI18nTest(TestCase): def test_cache_key_no_i18n (self): request = self._get_request() lang = translation.get_language() - tz = force_unicode(timezone.get_current_timezone_name(), errors='ignore') + tz = force_text(timezone.get_current_timezone_name(), errors='ignore') tz = tz.encode('ascii', 'ignore').replace(' ', '_') response = HttpResponse() key = learn_cache_key(request, response) |
