import unittest

import solution


class TestImages(unittest.TestCase):
    image = [
        [(0, 0, 255), (0, 255, 0), (0, 0, 255)],
        [(255, 0, 0), (0, 0, 255), (0, 255, 0)],
        [(0, 255, 0), (0, 255, 0), (255, 0, 0)]]

    def test_grayscale_rotate_left(self):
        rotated = solution.rotate_left(self.image)
        expected = [
            [(85, 85, 85), (85, 85, 85), (85, 85, 85)],
            [(85, 85, 85), (85, 85, 85), (85, 85, 85)],
            [(85, 85, 85), (85, 85, 85), (85, 85, 85)]]

        for i in range(len(expected)):
            for j in range(len(expected[0])):
                self.assertEqual(expected[i][j], rotated[i][j])

    def test_grayscale_lighten(self):
        lighten = solution.lighten(self.image, 0.5)
        expected = [
            [(170, 170, 170), (170, 170, 170), (170, 170, 170)],
            [(170, 170, 170), (170, 170, 170), (170, 170, 170)],
            [(170, 170, 170), (170, 170, 170), (170, 170, 170)]]

        for i in range(len(expected)):
            for j in range(len(expected[0])):
                self.assertEqual(expected[i][j], lighten[i][j])

    def test_grayscale_invert(self):
        inverted = solution.invert(self.image)
        expected = [
            [(170, 170, 170), (170, 170, 170), (170, 170, 170)],
            [(170, 170, 170), (170, 170, 170), (170, 170, 170)],
            [(170, 170, 170), (170, 170, 170), (170, 170, 170)]]

        for i in range(len(expected)):
            for j in range(len(expected[0])):
                self.assertEqual(expected[i][j], inverted[i][j])

    def test_grayscale_darken(self):
        inverted = solution.darken(self.image, 0.5)
        expected = [
            [(42, 42, 42), (42, 42, 42), (42, 42, 42)],
            [(42, 42, 42), (42, 42, 42), (42, 42, 42)],
            [(42, 42, 42), (42, 42, 42), (42, 42, 42)]]

        for i in range(len(expected)):
            for j in range(len(expected[0])):
                self.assertEqual(expected[i][j], inverted[i][j])


if __name__ == '__main__':
    unittest.main()

@@ -358,106 +358,56 @@
    %5B
-(85, 85, 85), (85, 85, 85), (85, 85, 85)%5D,%0A            %5B(85, 85, 85), (85, 85, 85), (85, 85, 85
+tuple(%5B85 for i in range(3)%5D) for i in range(3
 )%5D
-,
 %0A   
@@ -419,50 +419,25 @@
     
-%5B(85, 85, 85), (85, 85, 85), (85, 85, 85)%5D
+for i in range(3)
 %5D%0A%0A 
@@ -713,188 +713,87 @@
    %5B
-(170, 170, 170), (170, 170, 170), (170, 170, 170)%5D,%0A            %5B(170, 170, 170), (170, 170, 170), (170, 170, 170)%5D,%0A            %5B(170, 170, 170), (170, 170, 170), (170, 170, 170)%5D
+tuple(%5B170 for i in range(3)%5D) for i in range(3)%5D%0A            for i in range(3)
 %5D%0A%0A 
@@ -1063,188 +1063,87 @@
    %5B
-(170, 170, 170), (170, 170, 170), (170, 170, 170)%5D,%0A            %5B(170, 170, 170), (170, 170, 170), (170, 170, 170)%5D,%0A            %5B(170, 170, 170), (170, 170, 170), (170, 170, 170)%5D
+tuple(%5B170 for i in range(3)%5D) for i in range(3)%5D%0A            for i in range(3)
 %5D%0A%0A 
@@ -1419,106 +1419,56 @@
    %5B
-(42, 42, 42), (42, 42, 42), (42, 42, 42)%5D,%0A            %5B(42, 42, 42), (42, 42, 42), (42, 42, 42
+tuple(%5B42 for i in range(3)%5D) for i in range(3
 )%5D
-,
 %0A   
@@ -1480,50 +1480,25 @@
     
-%5B(42, 42, 42), (42, 42, 42), (42, 42, 42)%5D
+for i in range(3)
 %5D%0A%0A 

Add 02-challenge sample test file.