Pillow/Tests/test_features.py

34 lines
1016 B
Python
Raw Normal View History

2015-05-15 00:33:17 +03:00
from helper import unittest, PillowTestCase
from PIL import features
class TestFeatures(PillowTestCase):
def test_check_features(self):
for feature in features.modules:
2015-05-15 11:42:36 +03:00
self.assertTrue(
features.check_module(feature) in [True, False, None])
2015-05-15 00:33:17 +03:00
for feature in features.codecs:
self.assertTrue(features.check_codec(feature) in [True, False])
def test_supported_features(self):
self.assertIsInstance(features.get_supported_modules(), list)
self.assertIsInstance(features.get_supported_codecs(), list)
2015-05-15 00:33:17 +03:00
2015-05-15 11:42:36 +03:00
def test_unsupported_codec(self):
# Arrange
codec = "unsupported_codec"
# Act / Assert
self.assertRaises(ValueError, lambda: features.check_codec(codec))
def test_unsupported_module(self):
# Arrange
module = "unsupported_module"
# Act / Assert
self.assertRaises(ValueError, lambda: features.check_module(module))
2015-05-15 00:33:17 +03:00
if __name__ == '__main__':
unittest.main()