<s> import sys , os , inspect , unittest <EOL> from pymel . core import * <EOL> import pymel . core as pm <EOL> import pymel . versions as versions <EOL> import pymel . internal . factories as factories <EOL> import pymel . internal . pmcmds as pmcmds <EOL> import pymel . core . datatypes as dt <EOL> import pymel . core . nodetypes as nt <EOL> from maya . app . commands import __makeStubFunc as _makeStubFunc <EOL> def _makeAllAttrTypes ( nodeName ) : <EOL> cmds . sphere ( n = nodeName ) <EOL> attributeTypesToNames = { } <EOL> dataTypesToNames = { } <EOL> namesToType = { } <EOL> def doAttrAdd ( ** kwargs ) : <EOL> name = kwargs . get ( '<STR_LIT>' , kwargs . get ( '<STR_LIT>' ) ) <EOL> dt = kwargs . get ( '<STR_LIT>' , kwargs . get ( '<STR_LIT>' ) ) <EOL> if dt is not None : <EOL> dataTypesToNames . setdefault ( dt , [ ] ) . append ( name ) <EOL> namesToType [ name ] = ( '<STR_LIT>' , dt ) <EOL> else : <EOL> at = kwargs . get ( '<STR_LIT>' , kwargs . get ( '<STR_LIT>' ) ) <EOL> if at is None : <EOL> at = '<STR_LIT>' <EOL> attributeTypesToNames . setdefault ( dt , [ ] ) . append ( name ) <EOL> namesToType [ name ] = ( '<STR_LIT>' , at ) <EOL> cmds . addAttr ( ** kwargs ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = "<STR_LIT:float>" ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = "<STR_LIT:float>" ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = "<STR_LIT:float>" ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = "<STR_LIT:float>" ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = "<STR_LIT:float>" ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , p = '<STR_LIT>' , at = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , dt = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , dt = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , dt = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , dt = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , dt = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , dt = "<STR_LIT:string>" ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , dt = "<STR_LIT>" ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , dt = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , dt = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , dt = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , dt = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , dt = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , dt = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , dt = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , dt = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , dt = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , dt = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , dt = '<STR_LIT>' ) <EOL> doAttrAdd ( ln = '<STR_LIT>' , dt = '<STR_LIT>' ) <EOL> return attributeTypesToNames , dataTypesToNames , namesToType <EOL> class testCase_mayaSetAttr ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> _makeAllAttrTypes ( '<STR_LIT>' ) <EOL> def test_short2 ( self ) : <EOL> cmds . setAttr ( '<STR_LIT>' , <NUM_LIT:1> , <NUM_LIT:2> ) <EOL> assert cmds . getAttr ( '<STR_LIT>' ) == [ ( <NUM_LIT:1> , <NUM_LIT:2> ) ] <EOL> def test_short3 ( self ) : <EOL> cmds . setAttr ( '<STR_LIT>' , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> assert cmds . getAttr ( '<STR_LIT>' ) == [ ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) ] <EOL> def test_long2 ( self ) : <EOL> cmds . setAttr ( '<STR_LIT>' , <NUM_LIT:1> , <NUM_LIT:2> ) <EOL> assert cmds . getAttr ( '<STR_LIT>' ) == [ ( <NUM_LIT:1> , <NUM_LIT:2> ) ] <EOL> def test_long3 ( self ) : <EOL> cmds . setAttr ( '<STR_LIT>' , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> assert cmds . getAttr ( '<STR_LIT>' ) == [ ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) ] <EOL> def test_float2 ( self ) : <EOL> cmds . setAttr ( '<STR_LIT>' , <NUM_LIT:1> , <NUM_LIT:2> ) <EOL> assert cmds . getAttr ( '<STR_LIT>' ) == [ ( <NUM_LIT:1.0> , <NUM_LIT> ) ] <EOL> def test_float ( self ) : <EOL> cmds . setAttr ( '<STR_LIT>' , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> assert cmds . getAttr ( '<STR_LIT>' ) == [ ( <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT> ) ] <EOL> def test_double2 ( self ) : <EOL> cmds . setAttr ( '<STR_LIT>' , <NUM_LIT:1> , <NUM_LIT:2> ) <EOL> assert cmds . getAttr ( '<STR_LIT>' ) == [ ( <NUM_LIT:1.0> , <NUM_LIT> ) ] <EOL> def test_double3 ( self ) : <EOL> cmds . setAttr ( '<STR_LIT>' , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> assert cmds . getAttr ( '<STR_LIT>' ) == [ ( <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT> ) ] <EOL> def test_int32Array ( self ) : <EOL> cmds . setAttr ( '<STR_LIT>' , ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ) , type = '<STR_LIT>' ) <EOL> assert cmds . getAttr ( '<STR_LIT>' ) == [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] <EOL> def test_doubleArray ( self ) : <EOL> cmds . setAttr ( '<STR_LIT>' , ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ) , type = '<STR_LIT>' ) <EOL> assert cmds . getAttr ( '<STR_LIT>' ) == [ <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] <EOL> def test_pointArray ( self ) : <EOL> if versions . current ( ) < versions . v2011 : <EOL> cmds . setAttr ( '<STR_LIT>' , <NUM_LIT:2> , ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ) , "<STR_LIT>" , ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ) , type = '<STR_LIT>' ) <EOL> assert cmds . getAttr ( '<STR_LIT>' ) == [ ( <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , ( <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ] <EOL> else : <EOL> cmds . setAttr ( '<STR_LIT>' , <NUM_LIT:2> , ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ) , ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ) , type = '<STR_LIT>' ) <EOL> assert cmds . getAttr ( '<STR_LIT>' ) == [ ( <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , ( <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ] <EOL> def test_vectorArray ( self ) : <EOL> if versions . current ( ) < versions . v2011 : <EOL> cmds . setAttr ( '<STR_LIT>' , <NUM_LIT:2> , ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) , "<STR_LIT>" , ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) , type = '<STR_LIT>' ) <EOL> assert cmds . getAttr ( '<STR_LIT>' ) == [ <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT> ] <EOL> else : <EOL> cmds . setAttr ( '<STR_LIT>' , <NUM_LIT:2> , ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) , ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) , type = '<STR_LIT>' ) <EOL> assert cmds . getAttr ( '<STR_LIT>' ) == [ ( <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT> ) , ( <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT> ) ] <EOL> def test_stringArray ( self ) : <EOL> cmds . setAttr ( '<STR_LIT>' , <NUM_LIT:3> , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , type = '<STR_LIT>' ) <EOL> assert cmds . getAttr ( '<STR_LIT>' ) == [ u'<STR_LIT>' , u'<STR_LIT>' , u'<STR_LIT>' ] <EOL> def test_string ( self ) : <EOL> cmds . setAttr ( '<STR_LIT>' , '<STR_LIT>' , type = '<STR_LIT:string>' ) <EOL> assert cmds . getAttr ( '<STR_LIT>' ) == u'<STR_LIT>' <EOL> if versions . current ( ) >= versions . v2011 : <EOL> def test_matrix ( self ) : <EOL> cmds . setAttr ( '<STR_LIT>' , <NUM_LIT:1.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:1.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:1.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:1.0> , type = '<STR_LIT>' ) <EOL> assert cmds . getAttr ( '<STR_LIT>' ) == [ <NUM_LIT:1.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:1.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:1.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:1.0> ] <EOL> def test_sphere ( self ) : <EOL> cmds . setAttr ( '<STR_LIT>' , <NUM_LIT:1.0> , type = '<STR_LIT>' ) <EOL> def test_cone ( self ) : <EOL> cmds . setAttr ( '<STR_LIT>' , <NUM_LIT> , <NUM_LIT> , type = '<STR_LIT>' ) <EOL> def test_reflectanceRGB ( self ) : <EOL> cmds . setAttr ( '<STR_LIT>' , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , type = '<STR_LIT>' ) <EOL> def test_pymel_setAttr ( ) : <EOL> _makeAllAttrTypes ( '<STR_LIT>' ) <EOL> for data in [ <EOL> ( '<STR_LIT>' , ( <NUM_LIT:1> , <NUM_LIT:2> ) ) , <EOL> ( '<STR_LIT>' , ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) ) , <EOL> ( '<STR_LIT>' , ( <NUM_LIT:1> , <NUM_LIT:2> ) ) , <EOL> ( '<STR_LIT>' , ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) ) , <EOL> ( '<STR_LIT>' , ( <NUM_LIT:1.0> , <NUM_LIT> ) ) , <EOL> ( '<STR_LIT>' , ( <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT> ) ) , <EOL> ( '<STR_LIT>' , ( <NUM_LIT:1.0> , <NUM_LIT> ) ) , <EOL> ( '<STR_LIT>' , datatypes . Vector ( <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT> ) , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) , <EOL> ( '<STR_LIT>' , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] ) , <EOL> ( '<STR_LIT>' , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] ) , <EOL> ( '<STR_LIT>' , [ datatypes . Vector ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) , datatypes . Vector ( [ <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> ] ) ] , <EOL> [ [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , [ <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> ] ] ) , <EOL> ( '<STR_LIT>' , [ datatypes . Point ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) , datatypes . Point ( [ <NUM_LIT:2> , <NUM_LIT:4> , <NUM_LIT:6> ] ) ] , <EOL> [ [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> ] , [ <NUM_LIT:2> , <NUM_LIT:4> , <NUM_LIT:6> , <NUM_LIT:1> ] ] ) , <EOL> ( '<STR_LIT>' , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) , <EOL> ( '<STR_LIT:string>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , datatypes . Matrix ( ) , <EOL> [ <NUM_LIT:1.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:1.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:1.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:1.0> ] ) ] : <EOL> typ = data [ <NUM_LIT:0> ] <EOL> mainVal = data [ <NUM_LIT:1> ] <EOL> for i , val in enumerate ( data [ <NUM_LIT:1> : ] ) : <EOL> def testSetAttr ( * args ) : <EOL> at = '<STR_LIT>' + typ + '<STR_LIT>' <EOL> setAttr ( at , val ) <EOL> newval = getAttr ( at ) <EOL> assert newval == mainVal , "<STR_LIT>" % ( typ , newval , mainVal ) <EOL> testSetAttr . __name__ = '<STR_LIT>' + typ + '<STR_LIT:_>' + str ( i ) <EOL> testSetAttr . description = testSetAttr . __name__ <EOL> yield testSetAttr , <EOL> class testCase_enumAttr ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . node = cmds . createNode ( '<STR_LIT>' ) <EOL> self . attrName = '<STR_LIT>' <EOL> self . attr = '<STR_LIT>' % ( self . node , self . attrName ) <EOL> cmds . addAttr ( self . node , at = '<STR_LIT>' , longName = self . attrName , <EOL> enumName = '<STR_LIT>' , keyable = True ) <EOL> def test_setString ( self ) : <EOL> print "<STR_LIT>" , self . attr <EOL> setAttr ( self . attr , '<STR_LIT>' ) <EOL> self . assertEqual ( <NUM_LIT:1> , getAttr ( self . attr ) ) <EOL> setAttr ( self . attr , '<STR_LIT>' , asString = <NUM_LIT:1> ) <EOL> self . assertEqual ( <NUM_LIT:2> , getAttr ( self . attr ) ) <EOL> self . assertRaises ( MayaAttributeEnumError , setAttr , self . attr , '<STR_LIT:foo>' ) <EOL> class testCase_nodesAndAttributes ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . sphere1 , hist = polySphere ( ) <EOL> self . cube1 , hist = polyCube ( ) <EOL> self . grp1 = group ( self . sphere1 , self . cube1 ) <EOL> self . grp2 = duplicate ( self . grp1 ) [ <NUM_LIT:0> ] <EOL> self . sphere2 , self . cube2 = self . grp2 . getChildren ( ) <EOL> self . grp3 = instance ( self . grp1 ) [ <NUM_LIT:0> ] <EOL> self . sphere3 , self . cube3 = self . grp3 . getChildren ( ) <EOL> self . light = spotLight ( ) <EOL> currentTime ( <NUM_LIT:1> ) <EOL> setKeyframe ( self . light . intensity ) <EOL> currentTime ( <NUM_LIT:10> ) <EOL> self . light . intensity . set ( <NUM_LIT:10> ) <EOL> setKeyframe ( self . light . intensity ) <EOL> currentTime ( <NUM_LIT:1> ) <EOL> self . anim = self . light . intensity . inputs ( ) [ <NUM_LIT:0> ] <EOL> self . newobjs = [ ] <EOL> cmds . aliasAttr ( '<STR_LIT>' , self . sphere1 . name ( ) + '<STR_LIT>' ) <EOL> def test_attribute_parent_equality ( self ) : <EOL> self . assertEqual ( self . sphere2 . t . tx . parent ( ) , self . sphere2 . t ) <EOL> def test_attribute_duplicate_inequality ( self ) : <EOL> self . assert_ ( self . sphere1 . t != self . sphere2 . t ) <EOL> def test_attribute_instance_equality ( self ) : <EOL> self . assertEqual ( self . sphere1 . t , self . sphere3 . t ) <EOL> def test_attribute_cascading ( self ) : <EOL> self . sphere1 . primaryVisibility . set ( <NUM_LIT:1> ) <EOL> shape = self . sphere1 . getShape ( ) <EOL> self . assertEqual ( self . sphere1 . primaryVisibility , shape . primaryVisibility ) <EOL> def test_attribute_aliases ( self ) : <EOL> fromPyNode = pm . PyNode ( self . sphere1 . name ( ) + '<STR_LIT>' ) <EOL> self . assertTrue ( isinstance ( fromPyNode , pm . Attribute ) ) <EOL> fromAttr = self . sphere1 . attr ( '<STR_LIT>' ) <EOL> self . assertTrue ( isinstance ( fromAttr , pm . Attribute ) ) <EOL> res1 = self . sphere1 . listAttr ( alias = <NUM_LIT:1> ) <EOL> res2 = self . sphere1 . listAliases ( ) <EOL> self . assertEqual ( res1 [ <NUM_LIT:0> ] , res2 [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] ) <EOL> self . assertEqual ( fromPyNode , res1 [ <NUM_LIT:0> ] ) <EOL> self . assertEqual ( fromAttr , fromPyNode ) <EOL> def test_multi_compound_attribute_aliases ( self ) : <EOL> remap = pm . createNode ( '<STR_LIT>' ) <EOL> attr = remap . attr ( '<STR_LIT:value>' ) [ <NUM_LIT:0> ] . value_Position <EOL> attr . setAlias ( '<STR_LIT>' ) <EOL> fromPyNode = pm . PyNode ( remap . name ( ) + '<STR_LIT>' ) <EOL> self . assertTrue ( isinstance ( fromPyNode , pm . Attribute ) ) <EOL> fromAttr = remap . attr ( '<STR_LIT>' ) <EOL> self . assertTrue ( isinstance ( fromAttr , pm . Attribute ) ) <EOL> res1 = remap . listAttr ( alias = <NUM_LIT:1> ) <EOL> res2 = remap . listAliases ( ) <EOL> self . assertEqual ( res1 [ <NUM_LIT:0> ] , res2 [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] ) <EOL> self . assertEqual ( fromPyNode , res1 [ <NUM_LIT:0> ] ) <EOL> self . assertEqual ( fromAttr , fromPyNode ) <EOL> def test_pmcmds_objectErrors ( self ) : <EOL> self . assertRaises ( MayaAttributeError , setAttr , '<STR_LIT>' , <NUM_LIT:0> ) <EOL> self . assertRaises ( MayaAttributeError , getAttr , '<STR_LIT>' ) <EOL> self . assertRaises ( MayaNodeError , listConnections , '<STR_LIT>' ) <EOL> def test05_dagNode_addParent ( self ) : <EOL> sphere = polySphere ( ) [ <NUM_LIT:0> ] <EOL> cube = polyCube ( ) [ <NUM_LIT:0> ] <EOL> torus = polyTorus ( ) [ <NUM_LIT:0> ] <EOL> sphere | cube | torus <EOL> print torus . fullPath ( ) <EOL> def test06_instances ( self ) : <EOL> self . assert_ ( self . sphere1 . isInstanced ( ) ) <EOL> self . assert_ ( self . sphere1 . isInstanceOf ( self . sphere3 ) ) <EOL> def test_parentsAndChildren ( self ) : <EOL> shape = self . sphere1 . getShape ( ) <EOL> self . assertEqual ( shape , self . sphere1 . childAtIndex ( <NUM_LIT:0> ) ) <EOL> shape . hasParent ( self . sphere1 ) <EOL> self . assert_ ( shape . hasParent ( self . sphere1 ) ) <EOL> self . assert_ ( self . sphere1 . hasChild ( shape ) ) <EOL> self . sphere2 | self . grp1 <EOL> self . assertEqual ( self . cube1 . getParent ( <NUM_LIT:0> ) , self . cube1 ) <EOL> self . assertEqual ( self . cube1 . getParent ( generations = <NUM_LIT:1> ) , self . grp1 ) <EOL> self . assertEqual ( self . cube1 . getParent ( <NUM_LIT:2> ) , self . sphere2 ) <EOL> self . assertEqual ( self . cube1 . getParent ( generations = <NUM_LIT:3> ) , self . grp2 ) <EOL> self . assertEqual ( self . cube1 . getParent ( - <NUM_LIT:1> ) , self . grp2 ) <EOL> self . assertEqual ( self . cube1 . getParent ( generations = - <NUM_LIT:2> ) , self . sphere2 ) <EOL> self . assertEqual ( self . cube1 . getParent ( - <NUM_LIT:3> ) , self . grp1 ) <EOL> self . assertEqual ( self . cube1 . getParent ( generations = - <NUM_LIT:4> ) , self . cube1 ) <EOL> self . assertEqual ( self . cube1 . getParent ( - <NUM_LIT:5> ) , None ) <EOL> self . assertEqual ( self . cube1 . getParent ( generations = <NUM_LIT:4> ) , None ) <EOL> self . assertEqual ( self . cube1 . getParent ( - <NUM_LIT> ) , None ) <EOL> self . assertEqual ( self . cube1 . getParent ( generations = <NUM_LIT:32> ) , None ) <EOL> def test07_units ( self ) : <EOL> startLinear = currentUnit ( q = <NUM_LIT:1> , linear = <NUM_LIT:1> ) <EOL> startAngular = currentUnit ( q = <NUM_LIT:1> , angle = <NUM_LIT:1> ) <EOL> startTime = currentUnit ( q = <NUM_LIT:1> , time = <NUM_LIT:1> ) <EOL> currentUnit ( linear = '<STR_LIT>' ) <EOL> currentUnit ( angle = '<STR_LIT>' ) <EOL> currentUnit ( time = '<STR_LIT>' ) <EOL> testPairs = [ ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , datatypes . Vector ( [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1.0> ] ) ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT> ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT> ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT> ) , <EOL> ( '<STR_LIT>' % self . light , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT> ) , <EOL> ] <EOL> print <EOL> for attrName , getMethodName , setMethodName , realValue in testPairs : <EOL> at = PyNode ( attrName ) <EOL> node = at . node ( ) <EOL> getter = getattr ( node , getMethodName ) <EOL> setter = getattr ( node , setMethodName ) <EOL> print repr ( at ) <EOL> print "<STR_LIT>" , repr ( realValue ) <EOL> at . set ( realValue ) <EOL> gotValue = getter ( ) <EOL> print "<STR_LIT>" , repr ( gotValue ) <EOL> self . assertEqual ( realValue , gotValue ) <EOL> setter ( realValue ) <EOL> gotValue = at . get ( ) <EOL> self . assertEqual ( realValue , gotValue ) <EOL> self . assert_ ( self . anim . keyTimeValue [ <NUM_LIT:1> ] . keyTime . get ( ) == self . anim . getTime ( <NUM_LIT:1> ) ) <EOL> self . anim . setTime ( <NUM_LIT:1> , <NUM_LIT> ) <EOL> self . assert_ ( self . anim . keyTimeValue [ <NUM_LIT:1> ] . keyTime . get ( ) == self . anim . getTime ( <NUM_LIT:1> ) ) <EOL> currentUnit ( linear = startLinear ) <EOL> currentUnit ( angle = startAngular ) <EOL> currentUnit ( time = startTime ) <EOL> def test_classCreation ( self ) : <EOL> self . newobjs . append ( nt . Joint ( ) ) <EOL> self . newobjs . append ( nt . Transform ( ) ) <EOL> def test_transform_translation ( self ) : <EOL> SCENE . persp . setTranslation ( [ <NUM_LIT:10> , <NUM_LIT:20> , <NUM_LIT:30> ] , '<STR_LIT>' ) <EOL> self . assert_ ( SCENE . persp . getTranslation ( '<STR_LIT>' ) == datatypes . Vector ( [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) ) <EOL> SCENE . persp . setTranslation ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , '<STR_LIT>' , relative = <NUM_LIT:1> ) <EOL> self . assert_ ( SCENE . persp . getTranslation ( '<STR_LIT>' ) == datatypes . Vector ( [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) ) <EOL> undo ( ) <EOL> self . assert_ ( SCENE . persp . getTranslation ( '<STR_LIT>' ) == datatypes . Vector ( [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) ) <EOL> def test_transform_scale ( self ) : <EOL> SCENE . persp . setScale ( [ <NUM_LIT:10> , <NUM_LIT:20> , <NUM_LIT:30> ] ) <EOL> self . assert_ ( SCENE . persp . getScale ( ) == [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) <EOL> SCENE . persp . setScale ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , relative = <NUM_LIT:1> ) <EOL> self . assert_ ( SCENE . persp . getScale ( ) == [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) <EOL> undo ( ) <EOL> self . assert_ ( SCENE . persp . getScale ( ) == [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) <EOL> def test_transform_rotation ( self ) : <EOL> SCENE . persp . setRotation ( [ <NUM_LIT:10> , <NUM_LIT:20> , <NUM_LIT:0> ] , '<STR_LIT>' ) <EOL> self . assert_ ( SCENE . persp . getRotation ( '<STR_LIT>' ) . isEquivalent ( datatypes . EulerRotation ( [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0.0> ] ) ) ) <EOL> SCENE . persp . setRotation ( [ <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> ] , '<STR_LIT>' , relative = <NUM_LIT:1> ) <EOL> self . assert_ ( SCENE . persp . getRotation ( '<STR_LIT>' ) . isEquivalent ( datatypes . EulerRotation ( [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0.0> ] ) ) ) <EOL> undo ( ) <EOL> self . assert_ ( SCENE . persp . getRotation ( '<STR_LIT>' ) . isEquivalent ( datatypes . EulerRotation ( [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) ) ) <EOL> def test_immutability ( self ) : <EOL> c1 = polyCube ( ) [ <NUM_LIT:0> ] <EOL> c2 = polyCube ( ) [ <NUM_LIT:0> ] <EOL> nodeHash1 = c1 . __hash__ ( ) <EOL> nodeHash2 = c2 . __hash__ ( ) <EOL> attrHash1 = c1 . translate . __hash__ ( ) <EOL> attrHash2 = c2 . translate . __hash__ ( ) <EOL> self . assert_ ( nodeHash1 != nodeHash2 ) <EOL> self . assert_ ( attrHash1 != attrHash2 ) <EOL> c1 . rename ( '<STR_LIT>' ) <EOL> c2 . rename ( '<STR_LIT>' ) <EOL> self . assert_ ( nodeHash1 == c1 . __hash__ ( ) ) <EOL> self . assert_ ( nodeHash2 == c2 . __hash__ ( ) ) <EOL> self . assert_ ( attrHash1 == c1 . translate . __hash__ ( ) ) <EOL> self . assert_ ( attrHash2 == c2 . translate . __hash__ ( ) ) <EOL> def test_pynode_instantiation ( self ) : <EOL> plug = SCENE . persp . __apimfn__ ( ) . findPlug ( '<STR_LIT>' ) <EOL> obj = SCENE . persp . __apimobject__ ( ) <EOL> dag = SCENE . persp . __apimdagpath__ ( ) <EOL> PyNode ( obj ) . name ( ) <EOL> PyNode ( plug ) . name ( ) <EOL> PyNode ( dag ) . name ( ) <EOL> def tearDown ( self ) : <EOL> newFile ( f = <NUM_LIT:1> ) <EOL> class testCase_apiUndo ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> cmds . undoInfo ( state = <NUM_LIT:0> ) <EOL> setAttr ( '<STR_LIT>' , <NUM_LIT> ) <EOL> setAttr ( '<STR_LIT>' , <NUM_LIT> ) <EOL> factories . apiUndo . flushUndo ( ) <EOL> cmds . undoInfo ( state = <NUM_LIT:1> ) <EOL> def test_undo ( self ) : <EOL> self . assert_ ( len ( factories . apiUndo . undo_queue ) == <NUM_LIT:0> ) <EOL> SCENE . top . setFocalLength ( <NUM_LIT:20> ) <EOL> self . assert_ ( len ( factories . apiUndo . undo_queue ) == <NUM_LIT:1> ) <EOL> undoInfo ( stateWithoutFlush = <NUM_LIT:0> ) <EOL> SCENE . persp . setFocalLength ( <NUM_LIT:20> ) <EOL> self . assert_ ( len ( factories . apiUndo . undo_queue ) == <NUM_LIT:1> ) <EOL> undoInfo ( stateWithoutFlush = <NUM_LIT:1> ) <EOL> undo ( ) <EOL> self . assert_ ( SCENE . top . getFocalLength ( ) == <NUM_LIT> ) <EOL> self . assert_ ( SCENE . persp . getFocalLength ( ) == <NUM_LIT> ) <EOL> redo ( ) <EOL> self . assert_ ( SCENE . top . getFocalLength ( ) == <NUM_LIT> ) <EOL> self . assert_ ( SCENE . persp . getFocalLength ( ) == <NUM_LIT> ) <EOL> self . assert_ ( len ( factories . apiUndo . undo_queue ) == <NUM_LIT:1> ) <EOL> undoInfo ( state = <NUM_LIT:0> ) <EOL> undoInfo ( state = <NUM_LIT:1> ) <EOL> self . assert_ ( len ( factories . apiUndo . undo_queue ) == <NUM_LIT:0> ) <EOL> SCENE . top . setFocalLength ( <NUM_LIT:200> ) <EOL> undo ( ) <EOL> self . assert_ ( SCENE . persp . getFocalLength ( ) == <NUM_LIT> ) <EOL> self . assert_ ( SCENE . top . getFocalLength ( ) == <NUM_LIT> ) <EOL> self . assert_ ( len ( factories . apiUndo . undo_queue ) == <NUM_LIT:0> ) <EOL> def tearDown ( self ) : <EOL> newFile ( f = <NUM_LIT:1> ) <EOL> class testCase_listHistory ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . sphere1 , self . sphere1Maker = polySphere ( ) <EOL> self . sphere1Shape = self . sphere1 . getShape ( ) <EOL> self . cube1 = polyCube ( ) [ <NUM_LIT:0> ] <EOL> self . cube1Shape = self . cube1 . getShape ( ) <EOL> delete ( self . cube1 , ch = <NUM_LIT:1> ) <EOL> self . sphere1Shape . outMesh >> self . cube1Shape . inMesh <EOL> self . justSphereShape = set ( [ self . sphere1Shape ] ) <EOL> self . justPolySphere = set ( [ self . sphere1Maker ] ) <EOL> self . justCubeShape = set ( [ self . cube1Shape ] ) <EOL> self . polySphereAndShape = self . justSphereShape | self . justPolySphere <EOL> self . polySphereAndShapeAndCubeShape = self . polySphereAndShape | self . justCubeShape <EOL> self . shapes = self . justSphereShape | self . justCubeShape <EOL> def tearDown ( self ) : <EOL> delete ( self . sphere1 ) <EOL> delete ( self . cube1 ) <EOL> def test_listHistory ( self ) : <EOL> hist = set ( self . sphere1 . listHistory ( ) ) <EOL> self . assertEqual ( self . polySphereAndShape , hist ) <EOL> hist = set ( self . cube1 . listHistory ( ) ) <EOL> self . assertEqual ( self . polySphereAndShapeAndCubeShape , hist ) <EOL> def test_listHistoryType ( self ) : <EOL> hist = set ( self . sphere1 . listHistory ( type = '<STR_LIT>' ) ) <EOL> self . assertEqual ( self . justSphereShape , hist ) <EOL> hist = set ( self . sphere1 . listHistory ( type = '<STR_LIT>' ) ) <EOL> self . assertEqual ( self . justSphereShape , hist ) <EOL> hist = set ( self . cube1 . listHistory ( type = '<STR_LIT>' ) ) <EOL> self . assertEqual ( self . shapes , hist ) <EOL> hist = set ( self . cube1 . listHistory ( type = '<STR_LIT>' ) ) <EOL> self . assertEqual ( self . shapes , hist ) <EOL> def test_listHistoryExactType ( self ) : <EOL> hist = set ( self . sphere1 . listHistory ( exactType = '<STR_LIT>' ) ) <EOL> self . assertEqual ( set ( ) , hist ) <EOL> hist = set ( self . sphere1 . listHistory ( exactType = '<STR_LIT>' ) ) <EOL> self . assertEqual ( self . justSphereShape , hist ) <EOL> hist = set ( self . cube1 . listHistory ( exactType = '<STR_LIT>' ) ) <EOL> self . assertEqual ( set ( ) , hist ) <EOL> hist = set ( self . cube1 . listHistory ( exactType = '<STR_LIT>' ) ) <EOL> self . assertEqual ( self . shapes , hist ) <EOL> def test_listFuture ( self ) : <EOL> fut = set ( self . sphere1Maker . listFuture ( ) ) <EOL> self . assertEqual ( self . polySphereAndShapeAndCubeShape , fut ) <EOL> def test_listFutureType ( self ) : <EOL> fut = set ( self . sphere1Maker . listFuture ( type = '<STR_LIT>' ) ) <EOL> self . assertEqual ( self . shapes , fut ) <EOL> fut = set ( self . sphere1Maker . listFuture ( type = '<STR_LIT>' ) ) <EOL> self . assertEqual ( self . shapes , fut ) <EOL> def test_listFutureExactType ( self ) : <EOL> fut = set ( self . sphere1Maker . listFuture ( exactType = '<STR_LIT>' ) ) <EOL> self . assertEqual ( set ( ) , fut ) <EOL> fut = set ( self . sphere1Maker . listFuture ( exactType = '<STR_LIT>' ) ) <EOL> self . assertEqual ( self . shapes , fut ) <EOL> class testCase_duplicateShape ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> cmds . file ( new = <NUM_LIT:1> , f = <NUM_LIT:1> ) <EOL> self . poly = polyCube ( name = '<STR_LIT>' ) [ <NUM_LIT:0> ] <EOL> self . curve = circle ( name = '<STR_LIT>' ) [ <NUM_LIT:0> ] <EOL> tempShapeTransform = polyCone ( ) [ <NUM_LIT:0> ] <EOL> self . subd = polyToSubdiv ( tempShapeTransform , <EOL> constructionHistory = False , <EOL> name = '<STR_LIT>' ) [ <NUM_LIT:0> ] <EOL> delete ( tempShapeTransform ) <EOL> self . multiShape = polyCube ( name = '<STR_LIT>' ) [ <NUM_LIT:0> ] <EOL> self . multiShape . getShape ( ) . rename ( '<STR_LIT>' ) <EOL> tempShapeTransform = polyToSubdiv ( self . multiShape , <EOL> constructionHistory = False , <EOL> name = '<STR_LIT>' ) [ <NUM_LIT:0> ] <EOL> parent ( tempShapeTransform . getShape ( ) , self . multiShape , shape = True , <EOL> addObject = True , relative = True ) <EOL> delete ( tempShapeTransform ) <EOL> tempShapeTransform = circle ( name = '<STR_LIT>' ) [ <NUM_LIT:0> ] <EOL> parent ( tempShapeTransform . getShape ( ) , self . multiShape , shape = True , <EOL> addObject = True , relative = True ) <EOL> delete ( tempShapeTransform ) <EOL> def tearDown ( self ) : <EOL> for node in ( self . multiShape , self . poly , self . curve , self . subd ) : <EOL> delete ( node ) <EOL> def test_singleShapes ( self ) : <EOL> for shapeTransform in ( self . poly , self . curve , self . subd ) : <EOL> self . assertEqual ( len ( shapeTransform . getChildren ( shapes = <NUM_LIT:1> ) ) , <NUM_LIT:1> ) <EOL> self . assertRaises ( TypeError , duplicate , shapeTransform , addShape = True ) <EOL> self . assertEqual ( len ( shapeTransform . getChildren ( shapes = <NUM_LIT:1> ) ) , <NUM_LIT:1> ) <EOL> origShape = shapeTransform . getShape ( ) <EOL> shapeDup = duplicate ( origShape , addShape = True ) <EOL> self . assertEqual ( len ( shapeTransform . getChildren ( shapes = <NUM_LIT:1> ) ) , <NUM_LIT:2> ) <EOL> self . assertEqual ( len ( shapeDup ) , <NUM_LIT:1> ) <EOL> shapeDup = shapeDup [ <NUM_LIT:0> ] <EOL> self . assertDupeShape ( origShape , shapeDup ) <EOL> def test_multiShape ( self ) : <EOL> origShapes = self . multiShape . getChildren ( shapes = <NUM_LIT:1> ) <EOL> oldNumChildren = len ( origShapes ) <EOL> self . assertRaises ( TypeError , duplicate , self . multiShape , addShape = True ) <EOL> self . assertEqual ( len ( self . multiShape . getChildren ( shapes = <NUM_LIT:1> ) ) , <EOL> oldNumChildren ) <EOL> for origShape in origShapes : <EOL> shapeDup = duplicate ( origShape , addShape = True ) <EOL> self . assertEqual ( len ( self . multiShape . getChildren ( shapes = <NUM_LIT:1> ) ) , <EOL> oldNumChildren + <NUM_LIT:1> ) <EOL> oldNumChildren += <NUM_LIT:1> <EOL> self . assertEqual ( len ( shapeDup ) , <NUM_LIT:1> ) <EOL> shapeDup = shapeDup [ <NUM_LIT:0> ] <EOL> self . assertDupeShape ( origShape , shapeDup ) <EOL> def assertDupeShape ( self , origShape , shapeDup ) : <EOL> self . assertTrue ( shapeDup . __class__ == origShape . __class__ ) <EOL> if not isinstance ( origShape , ( nt . Subdiv , nt . NurbsCurve ) ) : <EOL> if shapeCompare ( origShape , shapeDup ) != <NUM_LIT:0> : <EOL> self . fail ( "<STR_LIT>" % <EOL> ( origShape , shapeDup ) ) <EOL> self . assertFalse ( origShape . isInstanceOf ( shapeDup ) ) <EOL> class test_PyNodeWraps ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> cmds . file ( new = <NUM_LIT:1> , f = <NUM_LIT:1> ) <EOL> def assertPyNode ( self , obj , nodeType = PyNode ) : <EOL> self . assert_ ( isinstance ( obj , nodeType ) , <EOL> '<STR_LIT>' % ( obj , nodeType . __name__ ) ) <EOL> def assertPyNodes ( self , objs , nodeType = PyNode ) : <EOL> for obj in objs : <EOL> self . assertPyNode ( obj , nodeType ) <EOL> def test_addAttr_QParent ( self ) : <EOL> cmds . polyCube ( ) <EOL> cmds . addAttr ( longName = '<STR_LIT>' , numberOfChildren = <NUM_LIT:5> , attributeType = '<STR_LIT>' ) <EOL> cmds . addAttr ( longName = '<STR_LIT>' , attributeType = '<STR_LIT>' , parent = '<STR_LIT>' ) <EOL> cmds . addAttr ( longName = '<STR_LIT>' , attributeType = '<STR_LIT:message>' , parent = '<STR_LIT>' ) <EOL> cmds . addAttr ( longName = '<STR_LIT>' , attributeType = '<STR_LIT>' , parent = '<STR_LIT>' ) <EOL> cmds . addAttr ( longName = '<STR_LIT>' , attributeType = '<STR_LIT>' , parent = '<STR_LIT>' ) <EOL> cmds . addAttr ( longName = '<STR_LIT>' , attributeType = '<STR_LIT>' , parent = '<STR_LIT>' ) <EOL> node = cmds . ls ( sl = <NUM_LIT:1> ) [ <NUM_LIT:0> ] <EOL> self . assertPyNode ( addAttr ( node + '<STR_LIT>' , q = <NUM_LIT:1> , parent = <NUM_LIT:1> ) , Attribute ) <EOL> def test_skinCluster_QGeometry ( self ) : <EOL> cube = cmds . polyCube ( ) [ <NUM_LIT:0> ] <EOL> j1 = cmds . joint ( p = ( <NUM_LIT:0> , <NUM_LIT:0> , - <NUM_LIT:1> ) ) <EOL> cmds . joint ( p = ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> ) ) <EOL> skin = pm . skinCluster ( cube , j1 ) <EOL> self . assertPyNodes ( skin . getGeometry ( ) , nt . DependNode ) <EOL> def test_addDynamic ( self ) : <EOL> cmds . emitter ( pos = ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) , type = '<STR_LIT>' , r = <NUM_LIT:100> , sro = <NUM_LIT:0> , nuv = <NUM_LIT:0> , cye = '<STR_LIT:none>' , cyi = <NUM_LIT:1> , spd = <NUM_LIT:1> , srn = <NUM_LIT:0> , nsp = <NUM_LIT:1> , tsp = <NUM_LIT:0> , mxd = <NUM_LIT:0> , mnd = <NUM_LIT:0> , dx = <NUM_LIT:1> , dy = <NUM_LIT:0> , dz = <NUM_LIT:0> , sp = <NUM_LIT:0> ) <EOL> cmds . particle ( ) <EOL> cmds . connectDynamic ( '<STR_LIT>' , em = '<STR_LIT>' ) <EOL> cmds . particle ( p = ( ( <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> ) , ( <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> ) ) , c = <NUM_LIT:1> ) <EOL> self . assertPyNodes ( addDynamic ( '<STR_LIT>' , '<STR_LIT>' ) , PyNode ) <EOL> def test_addPP ( self ) : <EOL> cmds . emitter ( n = '<STR_LIT>' ) <EOL> cmds . particle ( n = '<STR_LIT>' ) <EOL> cmds . connectDynamic ( '<STR_LIT>' , em = '<STR_LIT>' ) <EOL> cmds . select ( '<STR_LIT>' ) <EOL> cmds . emitter ( n = '<STR_LIT>' ) <EOL> cmds . particle ( n = '<STR_LIT>' ) <EOL> cmds . connectDynamic ( '<STR_LIT>' , em = '<STR_LIT>' ) <EOL> self . assertPyNodes ( addPP ( '<STR_LIT>' , atr = '<STR_LIT>' ) ) <EOL> def test_animLayer ( self ) : <EOL> self . assertEqual ( animLayer ( q = <NUM_LIT:1> , root = <NUM_LIT:1> ) , None ) <EOL> cmds . animLayer ( "<STR_LIT>" ) <EOL> rootLayer = animLayer ( q = <NUM_LIT:1> , root = <NUM_LIT:1> ) <EOL> self . assertPyNode ( rootLayer ) <EOL> self . assertEqual ( animLayer ( rootLayer , q = <NUM_LIT:1> , parent = <NUM_LIT:1> ) , None ) <EOL> self . assertPyNode ( animLayer ( "<STR_LIT>" , q = <NUM_LIT:1> , parent = <NUM_LIT:1> ) ) <EOL> self . assertEqual ( animLayer ( "<STR_LIT>" , q = <NUM_LIT:1> , children = <NUM_LIT:1> ) , [ ] ) <EOL> self . assertPyNodes ( animLayer ( rootLayer , q = <NUM_LIT:1> , children = <NUM_LIT:1> ) ) <EOL> self . assertEqual ( animLayer ( "<STR_LIT>" , q = <NUM_LIT:1> , attribute = <NUM_LIT:1> ) , [ ] ) <EOL> self . assertEqual ( animLayer ( "<STR_LIT>" , q = <NUM_LIT:1> , blendNodes = <NUM_LIT:1> ) , [ ] ) <EOL> cmds . animLayer ( "<STR_LIT>" , e = <NUM_LIT:1> , attribute = ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertPyNodes ( animLayer ( "<STR_LIT>" , q = <NUM_LIT:1> , attribute = <NUM_LIT:1> ) , Attribute ) <EOL> cmds . select ( '<STR_LIT>' ) <EOL> self . assertPyNodes ( animLayer ( q = <NUM_LIT:1> , bestAnimLayer = <NUM_LIT:1> ) ) <EOL> self . assertEqual ( animLayer ( "<STR_LIT>" , q = <NUM_LIT:1> , animCurves = <NUM_LIT:1> ) , [ ] ) <EOL> cmds . setKeyframe ( '<STR_LIT>' , animLayer = '<STR_LIT>' ) <EOL> self . assertPyNodes ( animLayer ( "<STR_LIT>" , q = <NUM_LIT:1> , animCurves = <NUM_LIT:1> ) ) <EOL> self . assertEqual ( animLayer ( '<STR_LIT>' , q = <NUM_LIT:1> , bac = <NUM_LIT:1> ) , [ ] ) <EOL> cmds . setKeyframe ( '<STR_LIT>' , animLayer = '<STR_LIT>' ) <EOL> self . assertPyNodes ( animLayer ( '<STR_LIT>' , q = <NUM_LIT:1> , bac = <NUM_LIT:1> ) ) <EOL> self . assertPyNodes ( animLayer ( "<STR_LIT>" , q = <NUM_LIT:1> , blendNodes = <NUM_LIT:1> ) ) <EOL> self . assertEqual ( animLayer ( "<STR_LIT>" , q = <NUM_LIT:1> , bestLayer = <NUM_LIT:1> ) , None ) <EOL> self . assertPyNode ( animLayer ( "<STR_LIT>" , q = <NUM_LIT:1> , bestLayer = <NUM_LIT:1> ) ) <EOL> cmds . select ( '<STR_LIT>' ) <EOL> self . assertEqual ( animLayer ( q = <NUM_LIT:1> , affectedLayers = <NUM_LIT:1> ) , [ ] ) <EOL> cmds . select ( '<STR_LIT>' ) <EOL> self . assertPyNodes ( animLayer ( q = <NUM_LIT:1> , affectedLayers = <NUM_LIT:1> ) ) <EOL> def test_annotate ( self ) : <EOL> cmds . sphere ( name = '<STR_LIT>' ) <EOL> self . assertPyNode ( annotate ( '<STR_LIT>' , tx = '<STR_LIT>' , p = ( <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:5> ) ) ) <EOL> def test_arclen ( self ) : <EOL> circle ( name = '<STR_LIT>' ) <EOL> self . assertPyNode ( arclen ( '<STR_LIT>' , ch = True ) ) <EOL> self . assertPyNode ( arclen ( '<STR_LIT>' ) , float ) <EOL> def test_arcLengthDimension ( self ) : <EOL> cmds . curve ( d = <NUM_LIT:3> , p = ( ( - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> ) , ( - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> ) , ( <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> ) , ( <NUM_LIT> , <NUM_LIT:0> , - <NUM_LIT> ) ) , k = ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:2> ) ) ; <EOL> self . assertPyNode ( arcLengthDimension ( '<STR_LIT>' ) ) <EOL> def test_arrayMapper ( self ) : <EOL> particle ( p = [ ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) , ( <NUM_LIT:3> , <NUM_LIT:5> , <NUM_LIT:6> ) , ( <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> ) , ( <NUM_LIT:9> , <NUM_LIT:9> , <NUM_LIT:9> ) ] ) <EOL> self . assertPyNode ( arrayMapper ( target = '<STR_LIT>' , destAttr = '<STR_LIT>' , inputV = '<STR_LIT>' , type = '<STR_LIT>' ) ) <EOL> if not cmds . about ( batch = <NUM_LIT:1> ) : <EOL> def test_art3dPaintCtx ( self ) : <EOL> polyCube ( ) <EOL> polyCube ( ) <EOL> select ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> from maya . mel import eval as mel <EOL> mel ( "<STR_LIT>" ) <EOL> mel ( "<STR_LIT>" ) <EOL> self . assertPyNodes ( art3dPaintCtx ( '<STR_LIT>' , q = <NUM_LIT:1> , shn = <NUM_LIT:1> ) ) <EOL> self . assertPyNodes ( art3dPaintCtx ( '<STR_LIT>' , q = <NUM_LIT:1> , hnm = <NUM_LIT:1> ) ) <EOL> def test_artAttrCtx ( self ) : <EOL> polyCube ( ) <EOL> polyCube ( ) <EOL> select ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> if not cmds . artAttrCtx ( '<STR_LIT>' , exists = <NUM_LIT:1> ) : <EOL> cmds . artAttrCtx ( '<STR_LIT>' ) <EOL> cmds . setToolTo ( '<STR_LIT>' ) <EOL> self . assertPyNodes ( artAttrCtx ( '<STR_LIT>' , q = <NUM_LIT:1> , paintNodeArray = <NUM_LIT:1> ) ) <EOL> for cmdName in ( '''<STR_LIT>''' ) . split ( ) : <EOL> melCmd = getattr ( cmds , cmdName , None ) <EOL> if not melCmd : continue <EOL> pyCmd = globals ( ) [ cmdName ] <EOL> def constraintTest ( self ) : <EOL> cmds . polyCube ( name = '<STR_LIT>' ) <EOL> cmds . circle ( name = '<STR_LIT>' ) <EOL> constr = melCmd ( '<STR_LIT>' , '<STR_LIT>' ) [ <NUM_LIT:0> ] <EOL> self . assertPyNodes ( pyCmd ( constr , q = <NUM_LIT:1> , targetList = <NUM_LIT:1> ) ) <EOL> self . assertPyNodes ( pyCmd ( constr , q = <NUM_LIT:1> , weightAliasList = <NUM_LIT:1> ) , Attribute ) <EOL> if '<STR_LIT>' in factories . cmdlist [ cmdName ] [ '<STR_LIT>' ] : <EOL> self . assertEqual ( pyCmd ( constr , q = <NUM_LIT:1> , worldUpObject = <NUM_LIT:1> ) , None ) <EOL> cmds . polySphere ( name = '<STR_LIT>' ) <EOL> melCmd ( constr , e = <NUM_LIT:1> , worldUpType = '<STR_LIT:object>' , worldUpObject = '<STR_LIT>' ) <EOL> self . assertPyNode ( pyCmd ( constr , q = <NUM_LIT:1> , worldUpObject = <NUM_LIT:1> ) ) <EOL> testName = "<STR_LIT>" + cmdName <EOL> constraintTest . __name__ = testName <EOL> setattr ( test_PyNodeWraps , testName , constraintTest ) <EOL> del globals ( ) [ '<STR_LIT>' ] <EOL> class test_commands ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> cmds . file ( new = <NUM_LIT:1> , f = <NUM_LIT:1> ) <EOL> self . dependNode = cmds . createNode ( '<STR_LIT>' ) <EOL> self . group = cmds . group ( '<STR_LIT>' ) <EOL> def test_duplicate ( self ) : <EOL> self . assert_ ( duplicate ( self . group ) ) <EOL> self . assert_ ( duplicate ( self . dependNode ) ) <EOL> class test_plugins ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> cmds . file ( new = <NUM_LIT:1> , f = <NUM_LIT:1> ) <EOL> if cmds . pluginInfo ( '<STR_LIT>' , q = <NUM_LIT:1> , loaded = <NUM_LIT:1> ) : <EOL> cmds . unloadPlugin ( '<STR_LIT>' ) <EOL> cmds . file ( new = <NUM_LIT:1> , f = <NUM_LIT:1> ) <EOL> if '<STR_LIT>' in nt . __dict__ : <EOL> del nt . __dict__ [ '<STR_LIT>' ] <EOL> if '<STR_LIT>' in nt . __class__ . __dict__ : <EOL> delattr ( nt . __class__ , '<STR_LIT>' ) <EOL> sys . modules . pop ( '<STR_LIT>' , None ) <EOL> def test01_load ( self ) : <EOL> self . assert_ ( '<STR_LIT>' not in nt . __dict__ ) <EOL> loadPlugin ( '<STR_LIT>' ) <EOL> self . assert_ ( '<STR_LIT>' not in nt . __dict__ ) <EOL> self . assert_ ( '<STR_LIT>' in nt . __class__ . __dict__ ) <EOL> nt . FurGlobals <EOL> self . assert_ ( '<STR_LIT>' in nt . __dict__ ) <EOL> def test02_unload ( self ) : <EOL> loadPlugin ( '<STR_LIT>' ) <EOL> unloadPlugin ( '<STR_LIT>' ) <EOL> self . assert_ ( '<STR_LIT>' not in nt . __dict__ ) <EOL> self . assertRaises ( AttributeError , getattr , nt , '<STR_LIT>' ) <EOL> self . assert_ ( '<STR_LIT>' not in nt . __dict__ ) <EOL> self . assert_ ( '<STR_LIT>' not in nt . __class__ . __dict__ ) <EOL> class test_move ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> cmds . file ( new = <NUM_LIT:1> , f = <NUM_LIT:1> ) <EOL> def test_relativeMove ( self ) : <EOL> cube = pm . polyCube ( ) [ <NUM_LIT:0> ] <EOL> pm . move ( <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , xyz = True , r = <NUM_LIT:1> ) <EOL> self . assertEqual ( cube . getTranslation ( ) , dt . Vector ( <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> ) ) <EOL> pm . move ( <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , xyz = True , r = <NUM_LIT:1> ) <EOL> self . assertEqual ( cube . getTranslation ( ) , dt . Vector ( <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:0> ) ) <EOL> pm . move ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , xyz = True , r = <NUM_LIT:1> ) <EOL> self . assertEqual ( cube . getTranslation ( ) , dt . Vector ( <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ) ) <EOL> class test_lazyDocs ( unittest . TestCase ) : <EOL> def test_getCmdName ( self ) : <EOL> cmd = cmds . filter <EOL> if not cmd . __name__ == '<STR_LIT>' : <EOL> cmd = _makeStubFunc ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( pmcmds . getCmdName ( cmd ) , '<STR_LIT>' ) <EOL> class test_hasAttr ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> pm . newFile ( f = <NUM_LIT:1> ) <EOL> self . loc = pm . spaceLocator ( ) <EOL> def test_transformAttr ( self ) : <EOL> self . assertTrue ( pm . hasAttr ( self . loc , '<STR_LIT>' , checkShape = False ) ) <EOL> self . assertTrue ( pm . hasAttr ( self . loc , '<STR_LIT>' , checkShape = True ) ) <EOL> self . assertTrue ( self . loc . hasAttr ( '<STR_LIT>' , checkShape = False ) ) <EOL> self . assertTrue ( self . loc . hasAttr ( '<STR_LIT>' , checkShape = True ) ) <EOL> def test_shapeAttr ( self ) : <EOL> self . assertFalse ( pm . hasAttr ( self . loc , '<STR_LIT>' , checkShape = False ) ) <EOL> self . assertTrue ( pm . hasAttr ( self . loc , '<STR_LIT>' , checkShape = True ) ) <EOL> self . assertFalse ( self . loc . hasAttr ( '<STR_LIT>' , checkShape = False ) ) <EOL> self . assertTrue ( self . loc . hasAttr ( '<STR_LIT>' , checkShape = True ) ) <EOL> def test_badAttr ( self ) : <EOL> self . assertFalse ( pm . hasAttr ( self . loc , '<STR_LIT>' , checkShape = False ) ) <EOL> self . assertFalse ( pm . hasAttr ( self . loc , '<STR_LIT>' , checkShape = True ) ) <EOL> self . assertFalse ( self . loc . hasAttr ( '<STR_LIT>' , checkShape = False ) ) <EOL> self . assertFalse ( self . loc . hasAttr ( '<STR_LIT>' , checkShape = True ) ) </s>
