Back to index

plone3  3.1.7
Public Member Functions | Private Attributes
Archetypes.tests.test_classgen.ClassGenTest Class Reference
Inheritance diagram for Archetypes.tests.test_classgen.ClassGenTest:
Inheritance graph
[legend]
Collaboration diagram for Archetypes.tests.test_classgen.ClassGenTest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def test_methods
def test_textfield
def test_filefield
def test_linesfield
def test_datefield
def test_objectfield
def test_fixedpointfield
def test_writeonlyfield
def test1_getbaseunit

Private Attributes

 _dummy

Detailed Description

Definition at line 122 of file test_classgen.py.


Member Function Documentation

Definition at line 124 of file test_classgen.py.

00124 
00125     def afterSetUp(self):
00126         ATSiteTestCase.afterSetUp(self)
00127         self._dummy = mkDummyInContext(Dummy, oid='dummy',
00128                                        context=self.portal,
00129                                        schema=schema)

Definition at line 195 of file test_classgen.py.

00195 
00196     def test1_getbaseunit(self):
00197         obj = self._dummy
00198         for field in obj.Schema().fields():
00199             if not hasattr(field, 'getBaseUnit'):
00200                 continue
00201             bu = field.getBaseUnit(obj)
00202             self.failUnless(IBaseUnit.isImplementedBy(bu),
00203                             ('Return value of %s.getBaseUnit() does not '
00204                              'implement BaseUnit: %s' %
00205                              (field.__class__, type(bu))))

Definition at line 175 of file test_classgen.py.

00175 
00176     def test_datefield(self):
00177         obj = self._dummy
00178         obj.setAdatefield('2002/01/01')
00179         self.failUnlessEqual(obj.getAdatefield(), DateTime('2002/01/01'))

Definition at line 165 of file test_classgen.py.

00165 
00166     def test_filefield(self):
00167         obj = self._dummy
00168         obj.setAfilefield('Bla')
00169         self.failUnlessEqual(str(obj.getAfilefield()), 'Bla')

Definition at line 185 of file test_classgen.py.

00185 
00186     def test_fixedpointfield(self):
00187         obj = self._dummy
00188         obj.setAfixedpointfield('26.05')
00189         self.failUnlessEqual(obj.getAfixedpointfield(), '26.05')

Definition at line 170 of file test_classgen.py.

00170 
00171     def test_linesfield(self):
00172         obj = self._dummy
00173         obj.setAlinesfield(['Bla', 'Ble', 'Bli'])
00174         self.failUnlessEqual(obj.getAlinesfield(), ('Bla', 'Ble', 'Bli'))

Definition at line 130 of file test_classgen.py.

00130 
00131     def test_methods(self):
00132         obj = self._dummy
00133         #setters
00134         self.failUnless(hasattr(obj, 'setAtextfield'))
00135         self.failUnless(hasattr(obj, 'setAfilefield'))
00136         self.failUnless(hasattr(obj, 'setAlinesfield'))
00137         self.failUnless(hasattr(obj, 'setAdatefield'))
00138         self.failUnless(hasattr(obj, 'setAnobjectfield'))
00139         self.failUnless(hasattr(obj, 'setAfixedpointfield'))
00140         self.failUnless(hasattr(obj, 'setAwriteonlyfield'))
00141         self.failUnless(not hasattr(obj, 'setAreadonlyfield'))
00142         #getters
00143         self.failUnless(hasattr(obj, 'getAtextfield'))
00144         self.failUnless(hasattr(obj, 'getAfilefield'))
00145         self.failUnless(hasattr(obj, 'getAlinesfield'))
00146         self.failUnless(hasattr(obj, 'getAdatefield'))
00147         self.failUnless(hasattr(obj, 'getAnobjectfield'))
00148         self.failUnless(hasattr(obj, 'getAfixedpointfield'))
00149         self.failUnless(not hasattr(obj, 'getAwriteonlyfield'))
00150         self.failUnless(hasattr(obj, 'getAreadonlyfield'))
00151         #raw getters
00152         self.failUnless(hasattr(obj, 'getRawAtextfield'))
00153         self.failUnless(hasattr(obj, 'getRawAfilefield'))
00154         self.failUnless(hasattr(obj, 'getRawAlinesfield'))
00155         self.failUnless(hasattr(obj, 'getRawAdatefield'))
00156         self.failUnless(hasattr(obj, 'getRawAnobjectfield'))
00157         self.failUnless(hasattr(obj, 'getRawAfixedpointfield'))
00158         self.failUnless(hasattr(obj, 'getRawAwriteonlyfield'))
00159         self.failUnless(not hasattr(obj, 'getRawAreadonlyfield'))

Definition at line 180 of file test_classgen.py.

00180 
00181     def test_objectfield(self):
00182         obj = self._dummy
00183         obj.setAnobjectfield('bla')
00184         self.failUnlessEqual(obj.getAnobjectfield(), 'bla')

Definition at line 160 of file test_classgen.py.

00160 
00161     def test_textfield(self):
00162         obj = self._dummy
00163         obj.setAtextfield('Bla', mimetype="text/plain")
00164         self.failUnlessEqual(str(obj.getAtextfield()), 'Bla')

Definition at line 190 of file test_classgen.py.

00190 
00191     def test_writeonlyfield(self):
00192         obj = self._dummy
00193         obj.setAwriteonlyfield('bla')
00194         self.failUnlessEqual(obj.getRawAwriteonlyfield(), 'bla')


Member Data Documentation

Definition at line 126 of file test_classgen.py.


The documentation for this class was generated from the following file: