diff options
| author | Max Peterson | 2014-04-28 13:10:34 +0100 | 
|---|---|---|
| committer | Max Peterson | 2014-04-28 13:10:34 +0100 | 
| commit | 170fa10ae0f2b531a8011be33cc9417b9f71e698 (patch) | |
| tree | 371384e1c6a68f9b43d7808b0cf6ba146edc426e | |
| parent | 1c777ffe8b67c342bc1b27fefe67d1094a2f6b07 (diff) | |
| download | django-rest-framework-170fa10ae0f2b531a8011be33cc9417b9f71e698.tar.bz2 | |
Python < 3 compatibility.
| -rw-r--r-- | rest_framework/tests/test_authentication.py | 8 | 
1 files changed, 7 insertions, 1 deletions
diff --git a/rest_framework/tests/test_authentication.py b/rest_framework/tests/test_authentication.py index 8773f580..34ce1b7a 100644 --- a/rest_framework/tests/test_authentication.py +++ b/rest_framework/tests/test_authentication.py @@ -199,7 +199,13 @@ class TokenAuthTests(TestCase):          """Ensure generate_key returns a string"""          token = Token()          key = token.generate_key() -        self.assertTrue(isinstance(key, str)) +        try: +            # added in Python < 3 +            base = unicode +        except NameError: +            # added in Python >= 3 +            base = str +        self.assertTrue(isinstance(key, base))      def test_token_login_json(self):          """Ensure token login view using JSON POST works."""  | 
