Add docstrings

This commit is contained in:
hugovk 2016-01-06 12:26:58 +02:00
parent 9dd68bb0be
commit 05b22cedd5

View File

@ -7,9 +7,11 @@ TEST_FILE_DXT3 = "Tests/images/dxt3-argb-8bbp-explicitalpha_MipMaps-1.dds"
TEST_FILE_DXT5 = "Tests/images/dxt5-argb-8bbp-interpolatedalpha_MipMaps-1.dds" TEST_FILE_DXT5 = "Tests/images/dxt5-argb-8bbp-interpolatedalpha_MipMaps-1.dds"
class TestFileCur(PillowTestCase): class TestFileDds(PillowTestCase):
"""Test DdsImagePlugin"""
def test_sanity_dxt1(self): def test_sanity_dxt1(self):
"""Check DXT1 images can be opened"""
im = Image.open(TEST_FILE_DXT1) im = Image.open(TEST_FILE_DXT1)
self.assertEqual(im.format, "DDS") self.assertEqual(im.format, "DDS")
@ -18,6 +20,7 @@ class TestFileCur(PillowTestCase):
self.assertIsInstance(im, DdsImagePlugin.DdsImageFile) self.assertIsInstance(im, DdsImagePlugin.DdsImageFile)
def test_sanity_dxt5(self): def test_sanity_dxt5(self):
"""Check DXT5 images can be opened"""
im = Image.open(TEST_FILE_DXT5) im = Image.open(TEST_FILE_DXT5)
self.assertEqual(im.format, "DDS") self.assertEqual(im.format, "DDS")
@ -26,10 +29,12 @@ class TestFileCur(PillowTestCase):
self.assertIsInstance(im, DdsImagePlugin.DdsImageFile) self.assertIsInstance(im, DdsImagePlugin.DdsImageFile)
def test_sanity_dxt3(self): def test_sanity_dxt3(self):
"""Check DXT3 images are not supported"""
self.assertRaises(NotImplementedError, self.assertRaises(NotImplementedError,
lambda: Image.open(TEST_FILE_DXT3)) lambda: Image.open(TEST_FILE_DXT3))
def test__validate_true(self): def test__validate_true(self):
"""Check valid prefix"""
# Arrange # Arrange
prefix = b"DDS etc" prefix = b"DDS etc"
@ -40,6 +45,7 @@ class TestFileCur(PillowTestCase):
self.assertTrue(output) self.assertTrue(output)
def test__validate_false(self): def test__validate_false(self):
"""Check invalid prefix"""
# Arrange # Arrange
prefix = b"something invalid" prefix = b"something invalid"