<s> import os <EOL> import IECore <EOL> import Gaffer <EOL> import GafferScene <EOL> import GafferSceneTest <EOL> class StandardAttributesTest ( GafferSceneTest . SceneTestCase ) : <EOL> def testDefaultValues ( self ) : <EOL> s = GafferScene . StandardAttributes ( ) <EOL> self . assertEqual ( s [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ "<STR_LIT:value>" ] . getValue ( ) , True ) <EOL> self . assertEqual ( s [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ "<STR_LIT:value>" ] . getValue ( ) , True ) <EOL> self . assertEqual ( s [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ "<STR_LIT:value>" ] . getValue ( ) , True ) <EOL> self . assertEqual ( s [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ "<STR_LIT:value>" ] . getValue ( ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( s [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ "<STR_LIT:value>" ] . getValue ( ) , True ) <EOL> self . assertEqual ( s [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ "<STR_LIT:value>" ] . getValue ( ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( s [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ "<STR_LIT:value>" ] . defaultValue ( ) , True ) <EOL> self . assertEqual ( s [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ "<STR_LIT:value>" ] . defaultValue ( ) , True ) <EOL> self . assertEqual ( s [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ "<STR_LIT:value>" ] . defaultValue ( ) , True ) <EOL> self . assertEqual ( s [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ "<STR_LIT:value>" ] . defaultValue ( ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( s [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ "<STR_LIT:value>" ] . defaultValue ( ) , True ) <EOL> self . assertEqual ( s [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ "<STR_LIT:value>" ] . defaultValue ( ) , <NUM_LIT:1> ) <EOL> def testSerialisationWithInvisibility ( self ) : <EOL> s = Gaffer . ScriptNode ( ) <EOL> s [ "<STR_LIT:a>" ] = GafferScene . StandardAttributes ( ) <EOL> s [ "<STR_LIT:a>" ] [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ "<STR_LIT:value>" ] . setValue ( False ) <EOL> s2 = Gaffer . ScriptNode ( ) <EOL> s2 . execute ( s . serialise ( ) ) <EOL> self . assertEqual ( s2 [ "<STR_LIT:a>" ] [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ "<STR_LIT:value>" ] . getValue ( ) , False ) <EOL> self . assertEqual ( s2 [ "<STR_LIT:a>" ] [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ "<STR_LIT:value>" ] . defaultValue ( ) , True ) <EOL> def testVisibilityBackwardCompatibility ( self ) : <EOL> s = Gaffer . ScriptNode ( ) <EOL> s [ "<STR_LIT>" ] . setValue ( os . path . dirname ( __file__ ) + "<STR_LIT>" ) <EOL> s . load ( ) <EOL> self . assertEqual ( s [ "<STR_LIT>" ] [ "<STR_LIT>" ] . attributes ( "<STR_LIT>" ) [ "<STR_LIT>" ] , IECore . BoolData ( False ) ) <EOL> def testGlobal ( self ) : <EOL> p = GafferScene . Plane ( ) <EOL> f = GafferScene . PathFilter ( ) <EOL> f [ "<STR_LIT>" ] . setValue ( IECore . StringVectorData ( [ "<STR_LIT>" ] ) ) <EOL> a = GafferScene . StandardAttributes ( ) <EOL> a [ "<STR_LIT>" ] . setInput ( p [ "<STR_LIT>" ] ) <EOL> a [ "<STR_LIT>" ] . setInput ( f [ "<STR_LIT>" ] ) <EOL> a [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ "<STR_LIT>" ] . setValue ( True ) <EOL> a [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ "<STR_LIT:value>" ] . setValue ( <NUM_LIT:2> ) <EOL> self . assertEqual ( a [ "<STR_LIT>" ] . attributes ( "<STR_LIT>" ) [ "<STR_LIT>" ] , IECore . IntData ( <NUM_LIT:2> ) ) <EOL> self . assertEqual ( a [ "<STR_LIT>" ] [ "<STR_LIT>" ] . hash ( ) , a [ "<STR_LIT>" ] [ "<STR_LIT>" ] . hash ( ) ) <EOL> self . assertEqual ( a [ "<STR_LIT>" ] [ "<STR_LIT>" ] . getValue ( ) , a [ "<STR_LIT>" ] [ "<STR_LIT>" ] . getValue ( ) ) <EOL> a [ "<STR_LIT>" ] . setValue ( True ) <EOL> self . assertEqual ( a [ "<STR_LIT>" ] . attributes ( "<STR_LIT>" ) , IECore . CompoundObject ( ) ) <EOL> self . assertEqual ( a [ "<STR_LIT>" ] . attributesHash ( "<STR_LIT>" ) , a [ "<STR_LIT>" ] . attributesHash ( "<STR_LIT>" ) ) <EOL> self . assertNotEqual ( a [ "<STR_LIT>" ] [ "<STR_LIT>" ] . hash ( ) , a [ "<STR_LIT>" ] [ "<STR_LIT>" ] . hash ( ) ) <EOL> self . assertEqual ( a [ "<STR_LIT>" ] [ "<STR_LIT>" ] . getValue ( ) [ "<STR_LIT>" ] , IECore . IntData ( <NUM_LIT:2> ) ) <EOL> def testPassThroughs ( self ) : <EOL> p = GafferScene . Plane ( ) <EOL> p [ "<STR_LIT>" ] . setValue ( "<STR_LIT>" ) <EOL> a = GafferScene . StandardAttributes ( ) <EOL> a [ "<STR_LIT>" ] . setInput ( p [ "<STR_LIT>" ] ) <EOL> self . assertEqual ( a [ "<STR_LIT>" ] [ "<STR_LIT>" ] . hash ( ) , p [ "<STR_LIT>" ] [ "<STR_LIT>" ] . hash ( ) ) <EOL> self . assertEqual ( a [ "<STR_LIT>" ] . setHash ( "<STR_LIT>" ) , p [ "<STR_LIT>" ] . setHash ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( a [ "<STR_LIT>" ] . set ( "<STR_LIT>" , _copy = False ) . isSame ( p [ "<STR_LIT>" ] . set ( "<STR_LIT>" , _copy = False ) ) ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
