Files
OpenColorIO/tests/python/TransformsBaseTest.py
T
Mei ChuandPatrick Hodoul 99c5f40af4 Created a TransformsBaseTest module. (#1288)
* Created a TransformsBaseTest module.
Moving some unit testing of Transforms module to a base class.

Signed-off-by: Mei Chu <meimchu@gmail.com>

* Updated four transforms tests to use TransformsBaseTest.
- AllocationTransformTest
- BuiltinTranformTest
- CDLTransformTest
- ColorSpaceTransformTest
Updated to add a space at the end of TransformBaseTest per feedback.

Signed-off-by: Mei Chu <meimchu@gmail.com>

* Updated four transforms tests to use TransformsBaseTest.
- DisplayViewTransformTest
- ExponentTransformTest
- ExponentWithLinearTransformTest
- ExposureContrastTransformTest
- FileTransformTest
- FixedFunctionTransformTest
- LogTransformTest
- LookTransformTest

Signed-off-by: Mei Chu <meimchu@gmail.com>

* Address feedback https://github.com/AcademySoftwareFoundation/OpenColorIO/pull/1288#discussion_r565265034

Signed-off-by: Mei Chu <meimchu@gmail.com>

* Updated a few transforms unit tests with TransformsBaseTest.

Signed-off-by: Mei Chu <meimchu@gmail.com>

* Updated to prioritize setUp methods first in individual python unit tests.

Signed-off-by: Mei Chu <meimchu@gmail.com>

Co-authored-by: Patrick Hodoul <patrick.hodoul@autodesk.com>
2021-02-17 14:50:47 -05:00

28 lines
788 B
Python

# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
import PyOpenColorIO as OCIO
class TransformsBaseTest(object):
def test_direction(self):
"""
Test the setDirection() and getDirection() methods.
"""
# Default initialized direction is forward.
self.assertEqual(self.tr.getDirection(), OCIO.TRANSFORM_DIR_FORWARD)
for direction in OCIO.TransformDirection.__members__.values():
self.tr.setDirection(direction)
self.assertEqual(self.tr.getDirection(), direction)
# Wrong type tests.
for invalid in (None, 1):
with self.assertRaises(TypeError):
self.tr.setDirection(invalid)
def tearDown(self):
self.tr = None