| 
					
				 | 
			
			
				@@ -18,6 +18,8 @@ from celery.tests.case import ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     AppCase, Mock, mask_modules, patch, reset_modules, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+PY3 = sys.version_info[0] == 3 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class SomeClass(object): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -122,10 +124,15 @@ class MyMemcachedStringEncodingError(Exception): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class MemcachedClient(DummyClient): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     def set(self, key, value, *args, **kwargs): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if isinstance(key, text_t): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if PY3: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            key_t, must_be, not_be, cod = bytes, 'string', 'bytes', 'decode' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            key_t, must_be, not_be, cod = text_t, 'bytes', 'string', 'encode' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if isinstance(key, key_t): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             raise MyMemcachedStringEncodingError( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                'Keys must be bytes, not string.  Convert your ' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                'strings using mystring.encode(charset)!') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'Keys must be {0}, not {1}.  Convert your ' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'strings using mystring.{2}(charset)!'.format( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    must_be, not_be, cod)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return super(MemcachedClient, self).set(key, value, *args, **kwargs) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |