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

Member Function Documentation

def Mixins.testMixins.testClone (   self)

Definition at line 633 of file Mixins.py.

634  def testClone(self):
635  class __Test(_TypedParameterizable):
636  pass
637  class __TestType(_SimpleParameterTypeBase):
638  def _isValid(self,value):
639  return True
640  a = __Test("MyType",t=__TestType(1), u=__TestType(2))
641  b = a.clone(t=3, v=__TestType(4))
642  self.assertEqual(a.t.value(),1)
643  self.assertEqual(a.u.value(),2)
644  self.assertEqual(b.t.value(),3)
645  self.assertEqual(b.u.value(),2)
646  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.

624  def testCopy(self):
625  class __Test(_TypedParameterizable):
626  pass
627  class __TestType(_SimpleParameterTypeBase):
628  def _isValid(self,value):
629  return True
630  a = __Test("MyType",t=__TestType(1), u=__TestType(2))
631  b = a.copy()
632  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.

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

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

Definition at line 580 of file Mixins.py.

581  def testListConstruction(self):
582  t = TestList(1)
583  self.assertEqual(t,[1])
584  t = TestList((1,))
585  self.assertEqual(t,[1])
586  t = TestList("one")
587  self.assertEqual(t,["one"])
588  t = TestList( [1,])
589  self.assertEqual(t,[1])
590  t = TestList( (x for x in [1]) )
591  self.assertEqual(t,[1])
592 
593  t = TestList(1,2)
594  self.assertEqual(t,[1,2])
595  t = TestList((1,2))
596  self.assertEqual(t,[1,2])
597  t = TestList("one","two")
598  self.assertEqual(t,["one","two"])
599  t = TestList(("one","two"))
600  self.assertEqual(t,["one","two"])
601  t = TestList( [1,2])
602  self.assertEqual(t,[1,2])
603  t = TestList( (x for x in [1,2]) )
604  self.assertEqual(t,[1,2])
605  t = TestList( iter((1,2)) )
606  self.assertEqual(t,[1,2])
607 
def testListConstruction
Definition: Mixins.py:580
def Mixins.testMixins.testModified (   self)

Definition at line 647 of file Mixins.py.

648  def testModified(self):
649  class __TestType(_SimpleParameterTypeBase):
650  def _isValid(self,value):
651  return True
652  a = __TestType(1)
653  self.assertEqual(a.isModified(),False)
654  a.setValue(1)
655  self.assertEqual(a.isModified(),False)
656  a.setValue(2)
657  self.assertEqual(a.isModified(),True)
658  a.resetModified()
659  self.assertEqual(a.isModified(),False)
unittest.main()
def Mixins.testMixins.testUsingBlock (   self)

Definition at line 620 of file Mixins.py.

621  def testUsingBlock(self):
622  a = UsingBlock("a")
self.assert_(isinstance(a, _ParameterTypeBase))
def testUsingBlock
Definition: Mixins.py:620

Member Data Documentation

Mixins.testMixins.TestList

Definition at line 617 of file Mixins.py.