[cgkit-commits] SF.net SVN: cgkit: [232] cgkit/trunk/unittests/test_mayaascii.py
Brought to you by:
mbaas
From: <mb...@us...> - 2008-02-19 21:51:17
|
Revision: 232 http://cgkit.svn.sourceforge.net/cgkit/?rev=232&view=rev Author: mbaas Date: 2008-02-19 13:51:04 -0800 (Tue, 19 Feb 2008) Log Message: ----------- Updates Modified Paths: -------------- cgkit/trunk/unittests/test_mayaascii.py Modified: cgkit/trunk/unittests/test_mayaascii.py =================================================================== --- cgkit/trunk/unittests/test_mayaascii.py 2008-02-19 21:48:53 UTC (rev 231) +++ cgkit/trunk/unittests/test_mayaascii.py 2008-02-19 21:51:04 UTC (rev 232) @@ -3,8 +3,23 @@ import unittest from cgkit import mayaascii +class TestReader(mayaascii.MAReader): + def onSetAttr(self, attr, vals, opts): +# print attr,vals,opts + a = mayaascii.Attribute(attr,vals,opts) + #print " ",a.getValue() + class TestMayaAscii(unittest.TestCase): + def testDefaultMAReader(self): + rd = TestReader() + rd.read("data/objects.ma") + + rd = mayaascii.DefaultMAReader() + rd.read("data/objects.ma") + t = rd.nodelist[0] +# print t.getAttrValue("t", "t", "double3") + def testMAReader_findString(self): """Test the MAReader.findString() method. """ @@ -33,7 +48,23 @@ self.assertEqual(rd.splitCommand('setAttr "foo spam"'), (["setAttr", '"foo spam"'],-1)) self.assertEqual(rd.splitCommand('setAttr "foo spam'), (["setAttr", '"foo spam"'],-1)) + def testMAReader_getOpt(self): + """Test the MAReader.splitCommand() method. + """ + rd = mayaascii.MAReader() + args,n = rd.splitCommand('setAttr -k off ".v"') + self.assertEqual(rd.getOpt(args[1:], rd.setAttr_opt_def, rd.setAttr_name_dict), (['".v"'], dict(keyable=["off"]))) + + args,n = rd.splitCommand('setAttr "-k" off ".v"') + self.assertEqual(rd.getOpt(args[1:], rd.setAttr_opt_def, rd.setAttr_name_dict), (['".v"'], dict(keyable=["off"]))) + + args,n = rd.splitCommand('setAttr ".cuvs" -type "string" "map1";') + self.assertEqual(rd.getOpt(args[1:], rd.setAttr_opt_def, rd.setAttr_name_dict), (['".cuvs"', '"map1"'], dict(type=["string"]))) + + self.assertEqual(rd.getOpt(["-5"], rd.setAttr_opt_def, rd.setAttr_name_dict), (["-5"], {})) + + ###################################################################### if __name__=="__main__": This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |