Esempio n. 1
0
    def test_assert_contains(self):
        backCol = (111, 22, 3)
        image = Image.new('RGB', (20, 10), backCol)

        newCol = (111, 22, 4)
        assertion = lambda: assert_contains(image, newCol)
        expectedMsg = 'does not contain %s. does contain:\n' \
            '  %s\n' % (newCol, set([backCol]))
        self.assertRaises(assertion, AssertionError, expectedMsg)

        assertion = lambda: assert_contains(image, newCol, 'desc')
        expectedMsg = 'does not contain %s. does contain:\n' \
            '  %s\ndesc' \
            % (newCol, set([backCol]))
        self.assertRaises(assertion, AssertionError, expectedMsg)

        image.putpixel((10, 5), newCol)
        assert_contains(image, newCol)
Esempio n. 2
0
 def test_assert_contains_with_rgba(self):
     backCol = (111, 22, 3)
     image = Image.new('RGBA', (20, 10), backCol)
     assert_contains(image, backCol)