<s> import os <EOL> import unittest <EOL> import IECore <EOL> import Gaffer <EOL> import GafferTest <EOL> import GafferImage <EOL> import GafferImageTest <EOL> class CDLTest ( GafferImageTest . ImageTestCase ) : <EOL> imageFile = os . path . expandvars ( "<STR_LIT>" ) <EOL> def test ( self ) : <EOL> n = GafferImage . ImageReader ( ) <EOL> n [ "<STR_LIT>" ] . setValue ( self . imageFile ) <EOL> orig = n [ "<STR_LIT>" ] . image ( ) <EOL> o = GafferImage . CDL ( ) <EOL> o [ "<STR_LIT>" ] . setInput ( n [ "<STR_LIT>" ] ) <EOL> self . assertEqual ( n [ "<STR_LIT>" ] . image ( ) , o [ "<STR_LIT>" ] . image ( ) ) <EOL> o [ '<STR_LIT>' ] . setValue ( IECore . Color3f ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) ) <EOL> slope = o [ "<STR_LIT>" ] . image ( ) <EOL> self . assertNotEqual ( orig , slope ) <EOL> o [ "<STR_LIT>" ] . setValue ( IECore . Color3f ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) ) <EOL> offset = o [ "<STR_LIT>" ] . image ( ) <EOL> self . assertNotEqual ( orig , offset ) <EOL> self . assertNotEqual ( slope , offset ) <EOL> o [ "<STR_LIT>" ] . setValue ( IECore . Color3f ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) ) <EOL> power = o [ "<STR_LIT>" ] . image ( ) <EOL> self . assertNotEqual ( orig , power ) <EOL> self . assertNotEqual ( slope , power ) <EOL> self . assertNotEqual ( offset , power ) <EOL> o [ "<STR_LIT>" ] . setValue ( <NUM_LIT:0.5> ) <EOL> saturation = o [ "<STR_LIT>" ] . image ( ) <EOL> self . assertNotEqual ( orig , saturation ) <EOL> self . assertNotEqual ( slope , saturation ) <EOL> self . assertNotEqual ( offset , saturation ) <EOL> self . assertNotEqual ( power , saturation ) <EOL> o [ "<STR_LIT>" ] . setValue ( <NUM_LIT:2> ) <EOL> inverse = o [ "<STR_LIT>" ] . image ( ) <EOL> self . assertNotEqual ( orig , inverse ) <EOL> self . assertNotEqual ( slope , inverse ) <EOL> self . assertNotEqual ( offset , inverse ) <EOL> self . assertNotEqual ( power , inverse ) <EOL> self . assertNotEqual ( saturation , inverse ) <EOL> def testHashPassThrough ( self ) : <EOL> n = GafferImage . ImageReader ( ) <EOL> n [ "<STR_LIT>" ] . setValue ( self . imageFile ) <EOL> o = GafferImage . CDL ( ) <EOL> o [ "<STR_LIT>" ] . setInput ( n [ "<STR_LIT>" ] ) <EOL> self . assertEqual ( n [ "<STR_LIT>" ] . image ( ) , o [ "<STR_LIT>" ] . image ( ) ) <EOL> o [ '<STR_LIT>' ] . setValue ( IECore . Color3f ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) ) <EOL> self . assertNotEqual ( n [ "<STR_LIT>" ] . image ( ) , o [ "<STR_LIT>" ] . image ( ) ) <EOL> o [ "<STR_LIT>" ] . setValue ( False ) <EOL> self . assertEqual ( n [ "<STR_LIT>" ] . image ( ) , o [ "<STR_LIT>" ] . image ( ) ) <EOL> self . assertEqual ( n [ "<STR_LIT>" ] [ '<STR_LIT>' ] . hash ( ) , o [ "<STR_LIT>" ] [ '<STR_LIT>' ] . hash ( ) ) <EOL> self . assertEqual ( n [ "<STR_LIT>" ] [ '<STR_LIT>' ] . hash ( ) , o [ "<STR_LIT>" ] [ '<STR_LIT>' ] . hash ( ) ) <EOL> self . assertEqual ( n [ "<STR_LIT>" ] [ "<STR_LIT>" ] . getValue ( ) , o [ "<STR_LIT>" ] [ "<STR_LIT>" ] . getValue ( ) ) <EOL> self . assertEqual ( n [ "<STR_LIT>" ] [ '<STR_LIT>' ] . hash ( ) , o [ "<STR_LIT>" ] [ '<STR_LIT>' ] . hash ( ) ) <EOL> o [ "<STR_LIT>" ] . setValue ( True ) <EOL> o [ '<STR_LIT>' ] . setValue ( o [ '<STR_LIT>' ] . defaultValue ( ) ) <EOL> self . assertEqual ( n [ "<STR_LIT>" ] . image ( ) , o [ "<STR_LIT>" ] . image ( ) ) <EOL> self . assertEqual ( n [ "<STR_LIT>" ] [ '<STR_LIT>' ] . hash ( ) , o [ "<STR_LIT>" ] [ '<STR_LIT>' ] . hash ( ) ) <EOL> self . assertEqual ( n [ "<STR_LIT>" ] [ '<STR_LIT>' ] . hash ( ) , o [ "<STR_LIT>" ] [ '<STR_LIT>' ] . hash ( ) ) <EOL> self . assertEqual ( n [ "<STR_LIT>" ] [ "<STR_LIT>" ] . getValue ( ) , o [ "<STR_LIT>" ] [ "<STR_LIT>" ] . getValue ( ) ) <EOL> self . assertEqual ( n [ "<STR_LIT>" ] [ '<STR_LIT>' ] . hash ( ) , o [ "<STR_LIT>" ] [ '<STR_LIT>' ] . hash ( ) ) <EOL> def testImageHashPassThrough ( self ) : <EOL> i = GafferImage . ImageReader ( ) <EOL> i [ "<STR_LIT>" ] . setValue ( self . imageFile ) <EOL> o = GafferImage . CDL ( ) <EOL> o [ "<STR_LIT>" ] . setInput ( i [ "<STR_LIT>" ] ) <EOL> self . assertEqual ( i [ "<STR_LIT>" ] . imageHash ( ) , o [ "<STR_LIT>" ] . imageHash ( ) ) <EOL> o [ '<STR_LIT>' ] . setValue ( IECore . Color3f ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) ) <EOL> self . assertNotEqual ( i [ "<STR_LIT>" ] . imageHash ( ) , o [ "<STR_LIT>" ] . imageHash ( ) ) <EOL> def testChannelsAreSeparate ( self ) : <EOL> i = GafferImage . ImageReader ( ) <EOL> i [ "<STR_LIT>" ] . setValue ( os . path . expandvars ( "<STR_LIT>" ) ) <EOL> o = GafferImage . CDL ( ) <EOL> o [ "<STR_LIT>" ] . setInput ( i [ "<STR_LIT>" ] ) <EOL> o [ '<STR_LIT>' ] . setValue ( IECore . Color3f ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) ) <EOL> self . assertNotEqual ( <EOL> o [ "<STR_LIT>" ] . channelDataHash ( "<STR_LIT:R>" , IECore . V2i ( <NUM_LIT:0> ) ) , <EOL> o [ "<STR_LIT>" ] . channelDataHash ( "<STR_LIT>" , IECore . V2i ( <NUM_LIT:0> ) ) <EOL> ) <EOL> self . assertNotEqual ( <EOL> o [ "<STR_LIT>" ] . channelData ( "<STR_LIT:R>" , IECore . V2i ( <NUM_LIT:0> ) ) , <EOL> o [ "<STR_LIT>" ] . channelData ( "<STR_LIT>" , IECore . V2i ( <NUM_LIT:0> ) ) <EOL> ) <EOL> def testPassThrough ( self ) : <EOL> i = GafferImage . ImageReader ( ) <EOL> i [ "<STR_LIT>" ] . setValue ( self . imageFile ) <EOL> o = GafferImage . CDL ( ) <EOL> o [ "<STR_LIT>" ] . setInput ( i [ "<STR_LIT>" ] ) <EOL> o [ '<STR_LIT>' ] . setValue ( IECore . Color3f ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) ) <EOL> self . assertEqual ( i [ "<STR_LIT>" ] [ "<STR_LIT>" ] . hash ( ) , o [ "<STR_LIT>" ] [ "<STR_LIT>" ] . hash ( ) ) <EOL> self . assertEqual ( i [ "<STR_LIT>" ] [ "<STR_LIT>" ] . hash ( ) , o [ "<STR_LIT>" ] [ "<STR_LIT>" ] . hash ( ) ) <EOL> self . assertEqual ( i [ "<STR_LIT>" ] [ "<STR_LIT>" ] . getValue ( ) , o [ "<STR_LIT>" ] [ "<STR_LIT>" ] . getValue ( ) ) <EOL> self . assertEqual ( i [ "<STR_LIT>" ] [ "<STR_LIT>" ] . hash ( ) , o [ "<STR_LIT>" ] [ "<STR_LIT>" ] . hash ( ) ) <EOL> self . assertEqual ( i [ "<STR_LIT>" ] [ "<STR_LIT>" ] . getValue ( ) , o [ "<STR_LIT>" ] [ "<STR_LIT>" ] . getValue ( ) ) <EOL> self . assertEqual ( i [ "<STR_LIT>" ] [ "<STR_LIT>" ] . getValue ( ) , o [ "<STR_LIT>" ] [ "<STR_LIT>" ] . getValue ( ) ) <EOL> self . assertEqual ( i [ "<STR_LIT>" ] [ "<STR_LIT>" ] . getValue ( ) , o [ "<STR_LIT>" ] [ "<STR_LIT>" ] . getValue ( ) ) <EOL> self . assertEqual ( i [ "<STR_LIT>" ] [ "<STR_LIT>" ] . getValue ( ) , o [ "<STR_LIT>" ] [ "<STR_LIT>" ] . getValue ( ) ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
