コード例 #1
0
ファイル: testimage_test.py プロジェクト: tartley/sole-scion
    def test_assert_entirely(self):
        backCol = (111, 22, 3)
        image = Image.new('RGB', (20, 10), backCol)
        assert_entirely(image, backCol)
        assert_entirely(image, backCol, "dontmatter")

        newCol = (111, 22, 4)
        image.putpixel((10, 5), newCol)

        assertion = lambda: assert_entirely(image, backCol)
        expectedMsg = '%s != %s\n  pixel %d,%d wrong color\n  ' % \
            (newCol, backCol, 10, 5)
        self.assertRaises(assertion, AssertionError, expectedMsg)

        assertion = lambda: assert_entirely(image, backCol, 'desc')
        expectedMsg = '%s != %s\n  pixel %d,%d wrong color\n  desc' % \
            (newCol, backCol, 10, 5)
        self.assertRaises(assertion, AssertionError, expectedMsg)
コード例 #2
0
ファイル: testimage_test.py プロジェクト: tartley/sole-scion
 def test_assert_entirely_with_rgba(self):
     backCol = (111, 22, 3)
     image = Image.new('RGBA', (20, 10), backCol)
     assert_entirely(image, backCol)