mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Allowed multiplication of lazy() objects with int return type.
This commit is contained in:
		
				
					committed by
					
						 Mariusz Felisiak
						Mariusz Felisiak
					
				
			
			
				
	
			
			
			
						parent
						
							45466f11f2
						
					
				
				
					commit
					fd97b0471b
				
			| @@ -163,6 +163,9 @@ def lazy(func, *resultclasses): | ||||
|         def __mod__(self, other): | ||||
|             return self.__cast() % other | ||||
|  | ||||
|         def __mul__(self, other): | ||||
|             return self.__cast() * other | ||||
|  | ||||
|     # Add wrappers for all methods from resultclasses which haven't been | ||||
|     # wrapped explicitly above. | ||||
|     for resultclass in resultclasses: | ||||
|   | ||||
| @@ -230,6 +230,7 @@ class FunctionalTests(SimpleTestCase): | ||||
|         lazy_5 = lazy(lambda: 5, int) | ||||
|         self.assertEqual(4 * lazy_5(), 20) | ||||
|         self.assertEqual(lazy_4() * 5, 20) | ||||
|         self.assertEqual(lazy_4() * lazy_5(), 20) | ||||
|  | ||||
|     def test_lazy_mul_list(self): | ||||
|         lazy_4 = lazy(lambda: [4], list) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user