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

Member Function Documentation

def Mixins.testMixins.testClone (   self)

Definition at line 624 of file Mixins.py.

625  def testClone(self):
626  class __Test(_TypedParameterizable):
627  pass
628  class __TestType(_SimpleParameterTypeBase):
629  def _isValid(self,value):
630  return True
631  a = __Test("MyType",t=__TestType(1), u=__TestType(2))
632  b = a.clone(t=3, v=__TestType(4))
633  self.assertEqual(a.t.value(),1)
634  self.assertEqual(a.u.value(),2)
635  self.assertEqual(b.t.value(),3)
636  self.assertEqual(b.u.value(),2)
637  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.

615  def testCopy(self):
616  class __Test(_TypedParameterizable):
617  pass
618  class __TestType(_SimpleParameterTypeBase):
619  def _isValid(self,value):
620  return True
621  a = __Test("MyType",t=__TestType(1), u=__TestType(2))
622  b = a.copy()
623  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.

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

600  def testLargeList(self):
601  #lists larger than 255 entries can not be initialized
602  #using the constructor
603  args = [i for i in xrange(0,300)]
604 
605  t = TestList(*args)
606  pdump= t.dumpPython()
607  class cms(object):
608  def __init__(self):
609  self.TestList = TestList
610  pythonized = eval( pdump, globals(),{'cms':cms()} )
self.assertEqual(t,pythonized)
list object
Definition: dbtoconf.py:77
def Mixins.testMixins.testListConstruction (   self)

Definition at line 571 of file Mixins.py.

572  def testListConstruction(self):
573  t = TestList(1)
574  self.assertEqual(t,[1])
575  t = TestList((1,))
576  self.assertEqual(t,[1])
577  t = TestList("one")
578  self.assertEqual(t,["one"])
579  t = TestList( [1,])
580  self.assertEqual(t,[1])
581  t = TestList( (x for x in [1]) )
582  self.assertEqual(t,[1])
583 
584  t = TestList(1,2)
585  self.assertEqual(t,[1,2])
586  t = TestList((1,2))
587  self.assertEqual(t,[1,2])
588  t = TestList("one","two")
589  self.assertEqual(t,["one","two"])
590  t = TestList(("one","two"))
591  self.assertEqual(t,["one","two"])
592  t = TestList( [1,2])
593  self.assertEqual(t,[1,2])
594  t = TestList( (x for x in [1,2]) )
595  self.assertEqual(t,[1,2])
596  t = TestList( iter((1,2)) )
597  self.assertEqual(t,[1,2])
598 
def testListConstruction
Definition: Mixins.py:571
def Mixins.testMixins.testModified (   self)

Definition at line 638 of file Mixins.py.

639  def testModified(self):
640  class __TestType(_SimpleParameterTypeBase):
641  def _isValid(self,value):
642  return True
643  a = __TestType(1)
644  self.assertEqual(a.isModified(),False)
645  a.setValue(1)
646  self.assertEqual(a.isModified(),False)
647  a.setValue(2)
648  self.assertEqual(a.isModified(),True)
649  a.resetModified()
650  self.assertEqual(a.isModified(),False)
unittest.main()
def Mixins.testMixins.testUsingBlock (   self)

Definition at line 611 of file Mixins.py.

612  def testUsingBlock(self):
613  a = UsingBlock("a")
self.assert_(isinstance(a, _ParameterTypeBase))
def testUsingBlock
Definition: Mixins.py:611

Member Data Documentation

Mixins.testMixins.TestList

Definition at line 608 of file Mixins.py.