          client = Client(enforce_csrf_checks=True)
          response = client.post('/auth-token/login/', 
                                 json.dumps({'username': self.username, 'password': self.password}), 'application/json')
          self.assertEqual(response.status_code, 200)
          self.assertEqual(json.loads(response.content)['token'], self.key)
  
      def test_token_login_json_bad_creds(self):
          """Ensure token login view using JSON POST fails if bad credentials are used."""
          client = Client(enforce_csrf_checks=True)
          response = client.post('/auth-token/login/', 
 
</s> remove         self.assertEqual(json.loads(response.content)['token'], self.key)
 </s> add         self.assertEqual(json.loads(response.content.decode('ascii'))['token'], self.key) </s> remove             for name,value in headers.iteritems():
 </s> add             for name, value in six.iteritems(headers): </s> remove         self.assertEquals(resp.content, '%s(%s);' % (callback_func, _flat_repr))
 </s> add         self.assertEquals(resp.content,
            ('%s(%s);' % (callback_func, _flat_repr)).encode('ascii')) </s> remove         self.assertEquals(resp.content, 'callback(%s);' % _flat_repr)
 </s> add         self.assertEquals(resp.content,
            ('callback(%s);' % _flat_repr).encode('ascii')) </s> remove         self.assertEquals(response.content, "404 Not Found")
 </s> add         self.assertEquals(response.content, six.b("404 Not Found"))
        self.assertEqual(json.loads(response.content.decode('ascii'))['token'], self.key)
          client = Client(enforce_csrf_checks=True)
          response = client.post('/auth-token/login/', 
                                 json.dumps({'username': self.username, 'password': self.password}), 'application/json')
          self.assertEqual(response.status_code, 200)
        self.assertEqual(json.loads(response.content.decode('ascii'))['token'], self.key)
  
      def test_token_login_json_bad_creds(self):
          """Ensure token login view using JSON POST fails if bad credentials are used."""
          client = Client(enforce_csrf_checks=True)
          response = client.post('/auth-token/login/', 
keep keep keep keep replace keep keep keep keep keep
 Every (base) test should now pass with python3. 
rest_framework/tests/authentication.py