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 570 of file Mixins.py.


Member Function Documentation

def Mixins::testMixins::testClone (   self)

Definition at line 624 of file Mixins.py.

00625                            :
00626             class __Test(_TypedParameterizable):
00627                 pass
00628             class __TestType(_SimpleParameterTypeBase):
00629                 def _isValid(self,value):
00630                     return True
00631             a = __Test("MyType",t=__TestType(1), u=__TestType(2))
00632             b = a.clone(t=3, v=__TestType(4))
00633             self.assertEqual(a.t.value(),1)
00634             self.assertEqual(a.u.value(),2)
00635             self.assertEqual(b.t.value(),3)
00636             self.assertEqual(b.u.value(),2)
00637             self.assertEqual(b.v.value(),4)
            self.assertRaises(TypeError,a.clone,None,**{"v":1})
def Mixins::testMixins::testCopy (   self)

Definition at line 614 of file Mixins.py.

00615                           :
00616             class __Test(_TypedParameterizable):
00617                 pass
00618             class __TestType(_SimpleParameterTypeBase):
00619                 def _isValid(self,value):
00620                     return True
00621             a = __Test("MyType",t=__TestType(1), u=__TestType(2))
00622             b = a.copy()
00623             self.assertEqual(b.t.value(),1)
            self.assertEqual(b.u.value(),2)
def Mixins::testMixins::testLargeList (   self)

Definition at line 599 of file Mixins.py.

00600                                :
00601             #lists larger than 255 entries can not be initialized
00602             #using the constructor
00603             args = [i for i in xrange(0,300)]
00604             
00605             t = TestList(*args)
00606             pdump= t.dumpPython()
00607             class cms(object):
00608                 def __init__(self):
00609                     self.TestList = TestList
00610             pythonized = eval( pdump, globals(),{'cms':cms()} )
            self.assertEqual(t,pythonized)
def Mixins::testMixins::testListConstruction (   self)

Definition at line 571 of file Mixins.py.

00572                                       :
00573             t = TestList(1)
00574             self.assertEqual(t,[1])
00575             t = TestList((1,))
00576             self.assertEqual(t,[1])
00577             t = TestList("one")
00578             self.assertEqual(t,["one"])
00579             t = TestList( [1,])
00580             self.assertEqual(t,[1])
00581             t = TestList( (x for x in [1]) )
00582             self.assertEqual(t,[1])
00583 
00584             t = TestList(1,2)
00585             self.assertEqual(t,[1,2])
00586             t = TestList((1,2))
00587             self.assertEqual(t,[1,2])
00588             t = TestList("one","two")
00589             self.assertEqual(t,["one","two"])
00590             t = TestList(("one","two"))
00591             self.assertEqual(t,["one","two"])
00592             t = TestList( [1,2])
00593             self.assertEqual(t,[1,2])
00594             t = TestList( (x for x in [1,2]) )
00595             self.assertEqual(t,[1,2])
00596             t = TestList( iter((1,2)) )
00597             self.assertEqual(t,[1,2])
00598             
            
def Mixins::testMixins::testModified (   self)

Definition at line 638 of file Mixins.py.

00639                               :
00640             class __TestType(_SimpleParameterTypeBase):
00641                 def _isValid(self,value):
00642                     return True
00643             a = __TestType(1)
00644             self.assertEqual(a.isModified(),False)
00645             a.setValue(1)
00646             self.assertEqual(a.isModified(),False)
00647             a.setValue(2)
00648             self.assertEqual(a.isModified(),True)
00649             a.resetModified()
00650             self.assertEqual(a.isModified(),False)
    unittest.main()
def Mixins::testMixins::testUsingBlock (   self)

Definition at line 611 of file Mixins.py.

00612                                 :
00613             a = UsingBlock("a")
            self.assert_(isinstance(a, _ParameterTypeBase))

Member Data Documentation

Definition at line 599 of file Mixins.py.