Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from Cimpl import *
- from Posterize import *
- def test_posterize(image: Image) -> str:
- """
- Checks every single pixel in the image and passes or fails. Returns 'Pass' if the value of any of the components is either 223, 195, 95, or 31 and returns 'Fail' if those requirements are not met.
- >>> test_posterize(posterize(new_image))
- """
- x = 0
- y = 0
- z = 0
- for pixels in image:
- x, y, (r,g,b) = pixels
- print(r, g, b)
- if (r == 223):
- x = True
- elif (r == 159):
- x = True
- elif (r == 95):
- x = True
- elif (r == 31):
- x = True
- else :
- x = False
- # --------------------------------------
- if (g == 223):
- y = True
- elif (g == 159):
- y = True
- elif (g == 95):
- y = True
- elif (g == 31):
- y = True
- else :
- y = False
- # --------------------------------------
- if (b == 223):
- z = True
- elif (b == 159):
- z = True
- elif (b == 95):
- z = True
- elif (b == 31):
- z = True
- else :
- z = False
- if x and y and z == True:
- print('Pass')
- else :
- print('Fail')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement