mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-31 07:57:27 +03:00 
			
		
		
		
	Re-roll in case of identical noise
This commit is contained in:
		
							parent
							
								
									2cb6523899
								
							
						
					
					
						commit
						c8eebc1dc7
					
				|  | @ -347,14 +347,24 @@ class TestImage(PillowTestCase): | |||
|         # Arrange | ||||
|         size = (100, 100) | ||||
|         sigma = 128 | ||||
|         # To reduce chance of randomly having the same value twice | ||||
|         attempts = 5 | ||||
| 
 | ||||
|         # Act | ||||
|         while attempts > 0: | ||||
|             im = Image.effect_noise(size, sigma) | ||||
| 
 | ||||
|             # Assert | ||||
|             self.assertEqual(im.size, (100, 100)) | ||||
|             self.assertEqual(im.mode, "L") | ||||
|         self.assertNotEqual(im.getpixel((0, 0)), im.getpixel((0, 1))) | ||||
|             p0 = im.getpixel((0, 0)) | ||||
|             p1 = im.getpixel((0, 1)) | ||||
|             if p0 == p1: | ||||
|                 # Let's roll again | ||||
|                 attempts -= 1 | ||||
|             else: | ||||
|                 break | ||||
|         self.assertNotEqual(p0, p1) | ||||
| 
 | ||||
|     def test_effect_spread(self): | ||||
|         # Arrange | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user