CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
Mixins.testMixins Class Reference
Inheritance diagram for Mixins.testMixins:

Public Member Functions

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

Public Attributes

 TestList
 
 tLPTest
 
 tLPTestType
 

Detailed Description

Definition at line 624 of file Mixins.py.

Member Function Documentation

def Mixins.testMixins.testClone (   self)

Definition at line 678 of file Mixins.py.

679  def testClone(self):
680  class __Test(_TypedParameterizable):
681  pass
682  class __TestType(_SimpleParameterTypeBase):
683  def _isValid(self,value):
684  return True
685  a = __Test("MyType",t=__TestType(1), u=__TestType(2))
686  b = a.clone(t=3, v=__TestType(4))
687  self.assertEqual(a.t.value(),1)
688  self.assertEqual(a.u.value(),2)
689  self.assertEqual(b.t.value(),3)
690  self.assertEqual(b.u.value(),2)
691  self.assertEqual(b.v.value(),4)
self.assertRaises(TypeError,a.clone,None,**{"v":1})
def Mixins.testMixins.testCopy (   self)

Definition at line 668 of file Mixins.py.

669  def testCopy(self):
670  class __Test(_TypedParameterizable):
671  pass
672  class __TestType(_SimpleParameterTypeBase):
673  def _isValid(self,value):
674  return True
675  a = __Test("MyType",t=__TestType(1), u=__TestType(2))
676  b = a.copy()
677  self.assertEqual(b.t.value(),1)
self.assertEqual(b.u.value(),2)
def Mixins.testMixins.testLargeList (   self)

Definition at line 653 of file Mixins.py.

References python.multivaluedict.__init__(), and dbtoconf.object.

654  def testLargeList(self):
655  #lists larger than 255 entries can not be initialized
656  #using the constructor
657  args = [i for i in xrange(0,300)]
658 
659  t = TestList(*args)
660  pdump= t.dumpPython()
661  class cms(object):
662  def __init__(self):
663  self.TestList = TestList
664  pythonized = eval( pdump, globals(),{'cms':cms()} )
self.assertEqual(t,pythonized)
list object
Definition: dbtoconf.py:77
def Mixins.testMixins.testLargeParameterizable (   self)

Definition at line 704 of file Mixins.py.

References Mixins.testMixins.tLPTest.

705  def testLargeParameterizable(self):
707  pass
709  def _isValid(self,value):
710  return True
711  class __DummyModule(object):
712  def __init__(self):
713  self.tLPTest = tLPTest
714  self.tLPTestType = tLPTestType
715  p = tLPTest("MyType",** dict( [ ("a"+str(x), tLPTestType(x)) for x in xrange(0,300) ] ) )
716  #check they are the same
717  self.assertEqual(p.dumpPython(), eval(p.dumpPython(),{"cms": __DummyModule()}).dumpPython())
unittest.main()
list object
Definition: dbtoconf.py:77
def testLargeParameterizable
Definition: Mixins.py:704
def Mixins.testMixins.testListConstruction (   self)

Definition at line 625 of file Mixins.py.

626  def testListConstruction(self):
627  t = TestList(1)
628  self.assertEqual(t,[1])
629  t = TestList((1,))
630  self.assertEqual(t,[1])
631  t = TestList("one")
632  self.assertEqual(t,["one"])
633  t = TestList( [1,])
634  self.assertEqual(t,[1])
635  t = TestList( (x for x in [1]) )
636  self.assertEqual(t,[1])
637 
638  t = TestList(1,2)
639  self.assertEqual(t,[1,2])
640  t = TestList((1,2))
641  self.assertEqual(t,[1,2])
642  t = TestList("one","two")
643  self.assertEqual(t,["one","two"])
644  t = TestList(("one","two"))
645  self.assertEqual(t,["one","two"])
646  t = TestList( [1,2])
647  self.assertEqual(t,[1,2])
648  t = TestList( (x for x in [1,2]) )
649  self.assertEqual(t,[1,2])
650  t = TestList( iter((1,2)) )
651  self.assertEqual(t,[1,2])
652 
def testListConstruction
Definition: Mixins.py:625
def Mixins.testMixins.testModified (   self)

Definition at line 692 of file Mixins.py.

693  def testModified(self):
694  class __TestType(_SimpleParameterTypeBase):
695  def _isValid(self,value):
696  return True
697  a = __TestType(1)
698  self.assertEqual(a.isModified(),False)
699  a.setValue(1)
700  self.assertEqual(a.isModified(),False)
701  a.setValue(2)
702  self.assertEqual(a.isModified(),True)
703  a.resetModified()
self.assertEqual(a.isModified(),False)
def Mixins.testMixins.testUsingBlock (   self)

Definition at line 665 of file Mixins.py.

666  def testUsingBlock(self):
667  a = UsingBlock("a")
self.assert_(isinstance(a, _ParameterTypeBase))
def testUsingBlock
Definition: Mixins.py:665

Member Data Documentation

Mixins.testMixins.TestList

Definition at line 662 of file Mixins.py.

Mixins.testMixins.tLPTest

Definition at line 712 of file Mixins.py.

Referenced by Mixins.testMixins.testLargeParameterizable().

Mixins.testMixins.tLPTestType

Definition at line 713 of file Mixins.py.