mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 09:57:55 +03:00 
			
		
		
		
	Python < 3 compatibility.
This commit is contained in:
		
							parent
							
								
									1c777ffe8b
								
							
						
					
					
						commit
						170fa10ae0
					
				| 
						 | 
					@ -199,7 +199,13 @@ class TokenAuthTests(TestCase):
 | 
				
			||||||
        """Ensure generate_key returns a string"""
 | 
					        """Ensure generate_key returns a string"""
 | 
				
			||||||
        token = Token()
 | 
					        token = Token()
 | 
				
			||||||
        key = token.generate_key()
 | 
					        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):
 | 
					    def test_token_login_json(self):
 | 
				
			||||||
        """Ensure token login view using JSON POST works."""
 | 
					        """Ensure token login view using JSON POST works."""
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user