CMS 3D CMS Logo

Public Member Functions | Public Attributes

Mixins::testMixins Class Reference

List of all members.

Public Member Functions

def testClone
def testCopy
def testLargeList
def testListConstruction
def testModified
def testUsingBlock

Public Attributes

 TestList

Detailed Description

Definition at line 579 of file Mixins.py.


Member Function Documentation

def Mixins::testMixins::testClone (   self)

Definition at line 633 of file Mixins.py.

00634                            :
00635             class __Test(_TypedParameterizable):
00636                 pass
00637             class __TestType(_SimpleParameterTypeBase):
00638                 def _isValid(self,value):
00639                     return True
00640             a = __Test("MyType",t=__TestType(1), u=__TestType(2))
00641             b = a.clone(t=3, v=__TestType(4))
00642             self.assertEqual(a.t.value(),1)
00643             self.assertEqual(a.u.value(),2)
00644             self.assertEqual(b.t.value(),3)
00645             self.assertEqual(b.u.value(),2)
00646             self.assertEqual(b.v.value(),4)
            self.assertRaises(TypeError,a.clone,None,**{"v":1})
def Mixins::testMixins::testCopy (   self)

Definition at line 623 of file Mixins.py.

00624                           :
00625             class __Test(_TypedParameterizable):
00626                 pass
00627             class __TestType(_SimpleParameterTypeBase):
00628                 def _isValid(self,value):
00629                     return True
00630             a = __Test("MyType",t=__TestType(1), u=__TestType(2))
00631             b = a.copy()
00632             self.assertEqual(b.t.value(),1)
            self.assertEqual(b.u.value(),2)
def Mixins::testMixins::testLargeList (   self)

Definition at line 608 of file Mixins.py.

00609                                :
00610             #lists larger than 255 entries can not be initialized
00611             #using the constructor
00612             args = [i for i in xrange(0,300)]
00613             
00614             t = TestList(*args)
00615             pdump= t.dumpPython()
00616             class cms(object):
00617                 def __init__(self):
00618                     self.TestList = TestList
00619             pythonized = eval( pdump, globals(),{'cms':cms()} )
            self.assertEqual(t,pythonized)
def Mixins::testMixins::testListConstruction (   self)

Definition at line 580 of file Mixins.py.

00581                                       :
00582             t = TestList(1)
00583             self.assertEqual(t,[1])
00584             t = TestList((1,))
00585             self.assertEqual(t,[1])
00586             t = TestList("one")
00587             self.assertEqual(t,["one"])
00588             t = TestList( [1,])
00589             self.assertEqual(t,[1])
00590             t = TestList( (x for x in [1]) )
00591             self.assertEqual(t,[1])
00592 
00593             t = TestList(1,2)
00594             self.assertEqual(t,[1,2])
00595             t = TestList((1,2))
00596             self.assertEqual(t,[1,2])
00597             t = TestList("one","two")
00598             self.assertEqual(t,["one","two"])
00599             t = TestList(("one","two"))
00600             self.assertEqual(t,["one","two"])
00601             t = TestList( [1,2])
00602             self.assertEqual(t,[1,2])
00603             t = TestList( (x for x in [1,2]) )
00604             self.assertEqual(t,[1,2])
00605             t = TestList( iter((1,2)) )
00606             self.assertEqual(t,[1,2])
00607             
            
def Mixins::testMixins::testModified (   self)

Definition at line 647 of file Mixins.py.

00648                               :
00649             class __TestType(_SimpleParameterTypeBase):
00650                 def _isValid(self,value):
00651                     return True
00652             a = __TestType(1)
00653             self.assertEqual(a.isModified(),False)
00654             a.setValue(1)
00655             self.assertEqual(a.isModified(),False)
00656             a.setValue(2)
00657             self.assertEqual(a.isModified(),True)
00658             a.resetModified()
00659             self.assertEqual(a.isModified(),False)
    unittest.main()
def Mixins::testMixins::testUsingBlock (   self)

Definition at line 620 of file Mixins.py.

00621                                 :
00622             a = UsingBlock("a")
            self.assert_(isinstance(a, _ParameterTypeBase))

Member Data Documentation

Definition at line 608 of file Mixins.py.