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 testListConstruction
 
def testModified
 
def testUsingBlock
 

Public Attributes

 TestList
 

Detailed Description

Definition at line 586 of file Mixins.py.

Member Function Documentation

def Mixins.testMixins.testClone (   self)

Definition at line 640 of file Mixins.py.

641  def testClone(self):
642  class __Test(_TypedParameterizable):
643  pass
644  class __TestType(_SimpleParameterTypeBase):
645  def _isValid(self,value):
646  return True
647  a = __Test("MyType",t=__TestType(1), u=__TestType(2))
648  b = a.clone(t=3, v=__TestType(4))
649  self.assertEqual(a.t.value(),1)
650  self.assertEqual(a.u.value(),2)
651  self.assertEqual(b.t.value(),3)
652  self.assertEqual(b.u.value(),2)
653  self.assertEqual(b.v.value(),4)
self.assertRaises(TypeError,a.clone,None,**{"v":1})
def Mixins.testMixins.testCopy (   self)

Definition at line 630 of file Mixins.py.

631  def testCopy(self):
632  class __Test(_TypedParameterizable):
633  pass
634  class __TestType(_SimpleParameterTypeBase):
635  def _isValid(self,value):
636  return True
637  a = __Test("MyType",t=__TestType(1), u=__TestType(2))
638  b = a.copy()
639  self.assertEqual(b.t.value(),1)
self.assertEqual(b.u.value(),2)
def Mixins.testMixins.testLargeList (   self)

Definition at line 615 of file Mixins.py.

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

616  def testLargeList(self):
617  #lists larger than 255 entries can not be initialized
618  #using the constructor
619  args = [i for i in xrange(0,300)]
620 
621  t = TestList(*args)
622  pdump= t.dumpPython()
623  class cms(object):
624  def __init__(self):
625  self.TestList = TestList
626  pythonized = eval( pdump, globals(),{'cms':cms()} )
self.assertEqual(t,pythonized)
list object
Definition: dbtoconf.py:77
def Mixins.testMixins.testListConstruction (   self)

Definition at line 587 of file Mixins.py.

588  def testListConstruction(self):
589  t = TestList(1)
590  self.assertEqual(t,[1])
591  t = TestList((1,))
592  self.assertEqual(t,[1])
593  t = TestList("one")
594  self.assertEqual(t,["one"])
595  t = TestList( [1,])
596  self.assertEqual(t,[1])
597  t = TestList( (x for x in [1]) )
598  self.assertEqual(t,[1])
599 
600  t = TestList(1,2)
601  self.assertEqual(t,[1,2])
602  t = TestList((1,2))
603  self.assertEqual(t,[1,2])
604  t = TestList("one","two")
605  self.assertEqual(t,["one","two"])
606  t = TestList(("one","two"))
607  self.assertEqual(t,["one","two"])
608  t = TestList( [1,2])
609  self.assertEqual(t,[1,2])
610  t = TestList( (x for x in [1,2]) )
611  self.assertEqual(t,[1,2])
612  t = TestList( iter((1,2)) )
613  self.assertEqual(t,[1,2])
614 
def testListConstruction
Definition: Mixins.py:587
def Mixins.testMixins.testModified (   self)

Definition at line 654 of file Mixins.py.

655  def testModified(self):
656  class __TestType(_SimpleParameterTypeBase):
657  def _isValid(self,value):
658  return True
659  a = __TestType(1)
660  self.assertEqual(a.isModified(),False)
661  a.setValue(1)
662  self.assertEqual(a.isModified(),False)
663  a.setValue(2)
664  self.assertEqual(a.isModified(),True)
665  a.resetModified()
666  self.assertEqual(a.isModified(),False)
unittest.main()
def Mixins.testMixins.testUsingBlock (   self)

Definition at line 627 of file Mixins.py.

628  def testUsingBlock(self):
629  a = UsingBlock("a")
self.assert_(isinstance(a, _ParameterTypeBase))
def testUsingBlock
Definition: Mixins.py:627

Member Data Documentation

Mixins.testMixins.TestList

Definition at line 624 of file Mixins.py.