Back to index

plone3  3.1.7
test_MetadataTool.py
Go to the documentation of this file.
00001 ##############################################################################
00002 #
00003 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
00004 #
00005 # This software is subject to the provisions of the Zope Public License,
00006 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
00007 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
00008 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00009 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
00010 # FOR A PARTICULAR PURPOSE.
00011 #
00012 ##############################################################################
00013 """ Unit tests for MetadataTool module.
00014 
00015 $Id: test_MetadataTool.py 77004 2007-06-24 08:57:54Z yuppie $
00016 """
00017 
00018 import unittest
00019 import Testing
00020 
00021 from Acquisition import aq_base
00022 
00023 
00024 class TestMetadataElementPolicy(unittest.TestCase):
00025 
00026     def _getTargetClass( self ):
00027         from Products.CMFDefault.MetadataTool import MetadataElementPolicy
00028         return MetadataElementPolicy
00029 
00030     def _makeOne( self, *args, **kw ):
00031         return self._getTargetClass()( *args, **kw )
00032 
00033     def test_empty_single_valued( self ):
00034         sv_policy = self._makeOne( 0 )
00035         self.failIf( sv_policy.isMultiValued() )
00036         self.failIf( sv_policy.isRequired() )
00037         self.failIf( sv_policy.supplyDefault() )
00038         self.failIf( sv_policy.defaultValue() )
00039         self.failIf( sv_policy.enforceVocabulary() )
00040         self.failIf( sv_policy.allowedVocabulary() )
00041 
00042     def test_edit_single_valued( self ):
00043         sv_policy = self._makeOne( 0 )
00044         sv_policy.edit( 1, 1, 'xxx', 0, '' )
00045         self.failIf( sv_policy.isMultiValued() )
00046         self.failUnless( sv_policy.isRequired() )
00047         self.failUnless( sv_policy.supplyDefault() )
00048         self.assertEquals( sv_policy.defaultValue(), 'xxx' )
00049         self.failIf( sv_policy.enforceVocabulary() )
00050         self.failIf( sv_policy.allowedVocabulary() )
00051 
00052     def test_empty_multi_valued( self ):
00053         mv_policy = self._makeOne( 1 )
00054         self.failUnless( mv_policy.isMultiValued() )
00055         self.failIf( mv_policy.isRequired() )
00056         self.failIf( mv_policy.supplyDefault() )
00057         self.failIf( mv_policy.defaultValue() )
00058         self.failIf( mv_policy.enforceVocabulary() )
00059         self.failIf( mv_policy.allowedVocabulary() )
00060 
00061     def test_edit_multi_valued( self ):
00062         mv_policy = self._makeOne( 1 )
00063         mv_policy.edit( 1, 1, 'xxx', 1, ( 'xxx', 'yyy' ) )
00064         self.failUnless( mv_policy.isMultiValued() )
00065         self.failUnless( mv_policy.isRequired() )
00066         self.failUnless( mv_policy.supplyDefault() )
00067         self.assertEqual( mv_policy.defaultValue(), 'xxx' )
00068         self.failUnless( mv_policy.enforceVocabulary() )
00069         self.assertEqual( len( mv_policy.allowedVocabulary() ), 2 )
00070         self.failUnless( 'xxx' in mv_policy.allowedVocabulary() )
00071         self.failUnless( 'yyy' in mv_policy.allowedVocabulary() )
00072 
00073 
00074 class TestElementSpec(unittest.TestCase):
00075 
00076     def _getTargetClass( self ):
00077         from Products.CMFDefault.MetadataTool import ElementSpec
00078         return ElementSpec
00079 
00080     def _makeOne( self, *args, **kw ):
00081         return self._getTargetClass()( *args, **kw )
00082 
00083     def test_empty_single_valued( self ):
00084         sv_spec = self._makeOne( 0 )
00085         self.failIf( sv_spec.isMultiValued() )
00086         self.assertEqual( sv_spec.getPolicy(), sv_spec.getPolicy( 'XYZ' ) )
00087         policies = sv_spec.listPolicies()
00088         self.assertEqual( len( policies ), 1 )
00089         self.assertEqual( policies[0][0], None )
00090 
00091     def test_empty_multi_valued( self ):
00092         mv_spec = self._makeOne( 1 )
00093         self.failUnless( mv_spec.isMultiValued() )
00094         self.assertEqual( mv_spec.getPolicy(), mv_spec.getPolicy( 'XYZ' ) )
00095         policies = mv_spec.listPolicies()
00096         self.assertEqual( len( policies ), 1 )
00097         self.assertEqual( policies[0][0], None )
00098 
00099 
00100 
00101 class TestMetadataSchema(unittest.TestCase):
00102 
00103     def _getTargetClass( self ):
00104         from Products.CMFDefault.MetadataTool import MetadataSchema
00105         return MetadataSchema
00106 
00107     def _makeOne( self, *args, **kw ):
00108         return self._getTargetClass()( *args, **kw )
00109 
00110 
00111 class TestMetadataTool(unittest.TestCase):
00112 
00113     def _getTargetClass( self ):
00114         from Products.CMFDefault.MetadataTool import MetadataTool
00115         return MetadataTool
00116 
00117     def _makeOne( self, *args, **kw ):
00118         return self._getTargetClass()( *args, **kw )
00119 
00120     def _makeTestObjects( self ):
00121 
00122         from Products.CMFDefault.DublinCore import DefaultDublinCoreImpl
00123         class Foo( DefaultDublinCoreImpl ):
00124 
00125             description = title = language = format = rights = ''
00126             subject = ()
00127 
00128             def __init__( self ):
00129                 pass # skip DDCI's default values
00130 
00131             def getPortalTypeName( self ):
00132                 return 'Foo'
00133 
00134 
00135         class Bar( Foo ):
00136 
00137             def getPortalTypeName( self ):
00138                 return 'Bar'
00139 
00140         return Foo(), Bar()
00141 
00142     def test_z2interfaces(self):
00143         from Interface.Verify import verifyClass
00144         from Products.CMFCore.interfaces.portal_metadata \
00145                 import portal_metadata as IMetadataTool
00146 
00147         verifyClass(IMetadataTool, self._getTargetClass())
00148 
00149     def test_z3interfaces(self):
00150         from zope.interface.verify import verifyClass
00151         from Products.CMFCore.interfaces import IMetadataTool
00152 
00153         verifyClass(IMetadataTool, self._getTargetClass())
00154 
00155     def test_empty( self ):
00156         from Products.CMFDefault.MetadataTool import _DCMI_ELEMENT_SPECS
00157 
00158         tool = self._makeOne()
00159         self.failIf( tool.getPublisher() )
00160         self.assertEqual( tool.getFullName( 'foo' ), 'foo' )
00161 
00162         dcmi = tool.DCMI
00163         specs = list( dcmi.DCMI.listElementSpecs() )
00164         defaults = list( _DCMI_ELEMENT_SPECS )
00165         specs.sort(); defaults.sort()
00166 
00167         self.assertEqual( len( specs ), len( defaults ) )
00168         for i in range( len( specs ) ):
00169             self.assertEqual( specs[i][0], defaults[i][0] )
00170             self.assertEqual( specs[i][1].isMultiValued(), defaults[i][1] )
00171             policies = specs[i][1].listPolicies()
00172             self.assertEqual( len( policies ), 1 )
00173             self.failUnless( policies[0][0] is None )
00174 
00175         self.failIf( dcmi.getElementSpec( 'Title' ).isMultiValued() )
00176         self.failIf( dcmi.getElementSpec( 'Description' ).isMultiValued() )
00177         self.failUnless( dcmi.getElementSpec( 'Subject' ).isMultiValued() )
00178         self.failIf( dcmi.getElementSpec( 'Format' ).isMultiValued() )
00179         self.failIf( dcmi.getElementSpec( 'Language' ).isMultiValued() )
00180         self.failIf( dcmi.getElementSpec( 'Rights' ).isMultiValued() )
00181 
00182         try:
00183             dummy = dcmi.getElementSpec( 'Foo' )
00184         except KeyError:
00185             pass
00186         else:
00187             self.failUnless( 0, "Expected KeyError" )
00188 
00189         self.failIf( dcmi.listAllowedSubjects() )
00190         self.failIf( dcmi.listAllowedFormats() )
00191         self.failIf( dcmi.listAllowedLanguages() )
00192         self.failIf( dcmi.listAllowedRights() )
00193 
00194     def test_DCMI_addElementSpec( self ):
00195         from Products.CMFDefault.MetadataTool import _DCMI_ELEMENT_SPECS
00196 
00197         tool = self._makeOne()
00198         dcmi = tool.DCMI
00199         dcmi.addElementSpec( 'Rating', 1 )
00200         self.assertEqual( len( dcmi.listElementSpecs() )
00201                         , len( _DCMI_ELEMENT_SPECS ) + 1 )
00202         rating = dcmi.getElementSpec( 'Rating' )
00203         self.failUnless( rating.isMultiValued() )
00204 
00205     def test_DCMI_removeElementSpec( self ):
00206         from Products.CMFDefault.MetadataTool import _DCMI_ELEMENT_SPECS
00207 
00208         tool = self._makeOne()
00209         dcmi = tool.DCMI
00210         dcmi.removeElementSpec( 'Rights' )
00211 
00212         self.assertEqual( len( dcmi.listElementSpecs() )
00213                         , len( _DCMI_ELEMENT_SPECS ) - 1
00214                         )
00215 
00216         self.assertRaises( KeyError, dcmi.getElementSpec, 'Rights' )
00217         self.assertRaises( KeyError, dcmi.removeElementSpec, 'Foo' )
00218 
00219     def test_simplePolicies( self ):
00220 
00221         tool = self._makeOne()
00222         dcmi = tool.DCMI
00223         tSpec = dcmi.getElementSpec( 'Title' )
00224 
00225         # Fetch default policy.
00226         tDef  = tSpec.getPolicy()
00227         self.failIf( tDef.isRequired() )
00228         self.failIf( tDef.supplyDefault() )
00229         self.failIf( tDef.defaultValue() )
00230 
00231         # Fetch (default) policy for a type.
00232         tDoc  = tSpec.getPolicy( 'Document' )
00233         self.assertEqual(aq_base(tDoc), aq_base(tDef))
00234 
00235         # Changing default changes policies found from there.
00236         tDef.edit( 1, 1, 'xyz', 0, () )
00237         self.failUnless( tDef.isRequired() )
00238         self.failUnless( tDef.supplyDefault() )
00239         self.assertEqual( tDef.defaultValue(), 'xyz' )
00240         self.failUnless( tDoc.isRequired() )
00241         self.failUnless( tDoc.supplyDefault() )
00242         self.assertEqual( tDoc.defaultValue(), 'xyz' )
00243 
00244         tSpec.addPolicy( 'Document' )
00245         self.assertEqual( len( tSpec.listPolicies() ), 2 )
00246 
00247         tDoc  = tSpec.getPolicy( 'Document' )
00248         self.assertNotEqual(aq_base(tDoc), aq_base(tDef))
00249         self.failIf( tDoc.isRequired() )
00250         self.failIf( tDoc.supplyDefault() )
00251         self.failIf( tDoc.defaultValue() )
00252 
00253         tSpec.removePolicy( 'Document' )
00254         tDoc  = tSpec.getPolicy( 'Document' )
00255         self.assertEqual(aq_base(tDoc), aq_base(tDef))
00256         self.failUnless( tDoc.isRequired() )
00257         self.failUnless( tDoc.supplyDefault() )
00258         self.assertEqual( tDoc.defaultValue(), 'xyz' )
00259 
00260     def test_multiValuedPolicies( self ):
00261 
00262         tool = self._makeOne()
00263         dcmi = tool.DCMI
00264         sSpec = dcmi.getElementSpec( 'Subject' )
00265 
00266         # Fetch default policy.
00267         sDef  = sSpec.getPolicy()
00268         self.failIf( sDef.isRequired() )
00269         self.failIf( sDef.supplyDefault() )
00270         self.failIf( sDef.defaultValue() )
00271         self.failIf( sDef.enforceVocabulary() )
00272         self.failIf( sDef.allowedVocabulary() )
00273 
00274         # Fetch (default) policy for a type.
00275         sDoc  = sSpec.getPolicy( 'Document' )
00276         self.assertEqual(aq_base(sDoc), aq_base(sDef))
00277 
00278         # Changing default changes policies found from there.
00279         sDef.edit( 1, 1, 'xyz', 1, ( 'foo', 'bar' ) )
00280         self.failUnless( sDef.isRequired() )
00281         self.failUnless( sDef.supplyDefault() )
00282         self.assertEqual( sDef.defaultValue(), 'xyz' )
00283         self.failUnless( sDoc.isRequired() )
00284         self.failUnless( sDoc.supplyDefault() )
00285         self.assertEqual( sDoc.defaultValue(), 'xyz' )
00286         self.failUnless( sDef.enforceVocabulary() )
00287         self.assertEqual( len( sDef.allowedVocabulary() ), 2 )
00288         self.failUnless( 'foo' in sDef.allowedVocabulary() )
00289         self.failUnless( 'bar' in sDef.allowedVocabulary() )
00290         self.failUnless( sDoc.enforceVocabulary() )
00291         self.assertEqual( len( sDoc.allowedVocabulary() ), 2 )
00292         self.failUnless( 'foo' in sDoc.allowedVocabulary() )
00293         self.failUnless( 'bar' in sDoc.allowedVocabulary() )
00294 
00295         sSpec.addPolicy( 'Document' )
00296         self.assertEqual( len( sSpec.listPolicies() ), 2 )
00297 
00298         sDoc  = sSpec.getPolicy( 'Document' )
00299         self.assertNotEqual(aq_base(sDoc), aq_base(sDef))
00300         self.failIf( sDoc.isRequired() )
00301         self.failIf( sDoc.supplyDefault() )
00302         self.failIf( sDoc.defaultValue() )
00303         self.failIf( sDoc.enforceVocabulary() )
00304         self.failIf( sDoc.allowedVocabulary() )
00305 
00306         sSpec.removePolicy( 'Document' )
00307         sDoc  = sSpec.getPolicy( 'Document' )
00308         self.assertEqual(aq_base(sDoc), aq_base(sDef))
00309         self.failUnless( sDoc.isRequired() )
00310         self.failUnless( sDoc.supplyDefault() )
00311         self.assertEqual( sDoc.defaultValue(), 'xyz' )
00312         self.failUnless( sDoc.enforceVocabulary() )
00313         self.assertEqual( len( sDoc.allowedVocabulary() ), 2 )
00314         self.failUnless( 'foo' in sDoc.allowedVocabulary() )
00315         self.failUnless( 'bar' in sDoc.allowedVocabulary() )
00316 
00317     def test_vocabularies( self ):
00318         tool = self._makeOne()
00319         dcmi = tool.DCMI
00320         fSpec   = dcmi.getElementSpec( 'Format' )
00321         fDef    = fSpec.getPolicy()
00322         formats = ( 'text/plain', 'text/html' )
00323         fDef.edit( 0, 0, '', 0, ( 'text/plain', 'text/html' ) )
00324         self.assertEqual( tool.listAllowedFormats(), formats )
00325 
00326         foo, bar = self._makeTestObjects()
00327 
00328         self.assertEqual( tool.listAllowedFormats( foo ), formats )
00329 
00330         fSpec.addPolicy( 'Foo' )
00331         self.failIf( tool.listAllowedFormats( foo ) )
00332 
00333         foo_formats = ( 'image/jpeg', 'image/gif', 'image/png' )
00334         fFoo        = fSpec.getPolicy( 'Foo' )
00335         fFoo.edit( 0, 0, '', 0, foo_formats )
00336         self.assertEqual( tool.listAllowedFormats( foo ), foo_formats )
00337 
00338     def test_initialValues_defaults( self ):
00339         tool = self._makeOne()
00340         foo, bar = self._makeTestObjects()
00341         self.failIf( foo.Title() )
00342         self.failIf( foo.Description() )
00343         self.failIf( foo.Subject() )
00344         self.failIf( foo.Format(), foo.Format() )
00345         self.failIf( foo.Language() )
00346         self.failIf( foo.Rights() )
00347 
00348         tool.setInitialMetadata( foo )
00349         self.failIf( foo.Title() )
00350         self.failIf( foo.Description() )
00351         self.failIf( foo.Subject() )
00352         self.failIf( foo.Format() )
00353         self.failIf( foo.Language() )
00354         self.failIf( foo.Rights() )
00355 
00356     def test_initialValues_implicit( self ):
00357         # Test default policy.
00358         tool = self._makeOne()
00359         dcmi = tool.DCMI
00360         foo, bar = self._makeTestObjects()
00361         fSpec   = dcmi.getElementSpec( 'Format' )
00362         fPolicy = fSpec.getPolicy()
00363         fPolicy.edit( 0, 1, 'text/plain', 0, () )
00364         tool.setInitialMetadata( foo )
00365         self.failIf( foo.Title() )
00366         self.failIf( foo.Description() )
00367         self.failIf( foo.Subject() )
00368         self.assertEqual( foo.Format(), 'text/plain' )
00369         self.failIf( foo.Language() )
00370         self.failIf( foo.Rights() )
00371 
00372     def test_initialValues_explicit_raises_if_constraint_fails( self ):
00373         from Products.CMFDefault.exceptions import MetadataError
00374 
00375         # Test type-specific policy.
00376         tool = self._makeOne()
00377         dcmi = tool.DCMI
00378         foo, bar = self._makeTestObjects()
00379         tSpec   = dcmi.getElementSpec( 'Title' )
00380         tSpec.addPolicy( 'Foo' )
00381         tPolicy = tSpec.getPolicy( foo.getPortalTypeName() )
00382         tPolicy.edit( 1, 0, '', 0, () )
00383 
00384         self.assertRaises( MetadataError, tool.setInitialMetadata, foo )
00385 
00386     def test_initialValues_explicit_mutliple_types( self ):
00387         tool = self._makeOne()
00388         dcmi = tool.DCMI
00389         foo, bar = self._makeTestObjects()
00390         foo.setTitle( 'Foo title' )
00391 
00392         fSpec   = dcmi.getElementSpec( 'Format' )
00393         fSpec.addPolicy( foo.getPortalTypeName() )
00394         fPolicy = fSpec.getPolicy( foo.getPortalTypeName() )
00395         fPolicy.edit( 0, 1, 'text/plain', 0, () )
00396 
00397         tool.setInitialMetadata( foo )
00398         self.assertEqual( foo.Title(), 'Foo title' )
00399         self.failIf( foo.Description() )
00400         self.failIf( foo.Subject() )
00401         self.assertEqual( foo.Format(), 'text/plain' )
00402         self.failIf( foo.Language() )
00403         self.failIf( foo.Rights() )
00404 
00405         #   Ensure Foo's policy doesn't interfere with other types.
00406         tool.setInitialMetadata( bar )
00407         self.failIf( bar.Title() )
00408         self.failIf( bar.Description() )
00409         self.failIf( bar.Subject() )
00410         self.assertEqual( bar.Format(), '' )
00411         self.failIf( bar.Language() )
00412         self.failIf( bar.Rights() )
00413 
00414     def test_validation( self ):
00415         from Products.CMFDefault.exceptions import MetadataError
00416 
00417         tool = self._makeOne()
00418         foo, bar = self._makeTestObjects()
00419         tool.setInitialMetadata( foo )
00420         tool.validateMetadata( foo )
00421 
00422         dcmi = tool.DCMI
00423         tSpec   = dcmi.getElementSpec( 'Title' )
00424         tSpec.addPolicy( 'Foo' )
00425         tPolicy = tSpec.getPolicy( foo.getPortalTypeName() )
00426         tPolicy.edit( 1, 0, '', 0, () )
00427 
00428         self.assertRaises( MetadataError, tool.validateMetadata, foo )
00429 
00430         foo.setTitle( 'Foo title' )
00431         tool.validateMetadata( foo )
00432 
00433     def test_addSchema_normal( self ):
00434         from Products.CMFDefault.MetadataTool import MetadataSchema
00435 
00436         tool = self._makeOne()
00437         before = tool.listSchemas()
00438         self.assertEqual( len( before ), 1 )
00439         self.assertEqual( before[0][0], 'DCMI' )
00440         self.failUnless( isinstance( before[0][1], MetadataSchema ) )
00441 
00442         tool.addSchema( 'Arbitrary' )
00443 
00444         after = tool.listSchemas()
00445         self.assertEqual( len( after ), 2 )
00446         self.assertEqual( after[0][0], 'DCMI' )
00447         self.failUnless( isinstance( after[0][1], MetadataSchema ) )
00448         self.assertEqual( after[1][0], 'Arbitrary' )
00449         self.failUnless( isinstance( after[1][1], MetadataSchema ) )
00450 
00451     def test_addSchema_duplicate( self ):
00452         tool = self._makeOne()
00453         before = tool.listSchemas()
00454         tool.addSchema( 'Arbitrary' )
00455         self.assertRaises( KeyError, tool.addSchema, 'Arbitrary' )
00456         self.assertRaises( KeyError, tool.addSchema, 'DCMI' )
00457 
00458     def test_removeSchema_normal( self ):
00459         tool = self._makeOne()
00460         before = tool.listSchemas()
00461         self.assertEqual( len( before ), 1 )
00462         self.assertEqual( before[0][0], 'DCMI' )
00463 
00464         tool.addSchema( 'Arbitrary' )
00465         tool.addSchema( 'Beneficent' )
00466         tool.addSchema( 'Grouchy' )
00467 
00468         middle = tool.listSchemas()
00469         self.assertEqual( len( middle ), 4 )
00470         self.assertEqual( middle[0][0], 'DCMI' )
00471         self.assertEqual( middle[1][0], 'Arbitrary' )
00472         self.assertEqual( middle[2][0], 'Beneficent' )
00473         self.assertEqual( middle[3][0], 'Grouchy' )
00474 
00475         tool.removeSchema( 'Beneficent' )
00476 
00477         after = tool.listSchemas()
00478         self.assertEqual( len( after ), 3 )
00479         self.assertEqual( after[0][0], 'DCMI' )
00480         self.assertEqual( after[1][0], 'Arbitrary' )
00481         self.assertEqual( after[2][0], 'Grouchy' )
00482 
00483     def test_removeSchema_invalid( self ):
00484         tool = self._makeOne()
00485         self.assertRaises( KeyError, tool.removeSchema, 'DCMI' )
00486         tool.addSchema( 'Arbitrary' )
00487         tool.removeSchema( 'Arbitrary' )
00488         self.assertRaises( KeyError, tool.removeSchema, 'Arbitrary' )
00489 
00490     def test_migration( self ):
00491         # Test that we forward-migrate old-style DCMI policies.
00492         from Products.CMFDefault.MetadataTool import ElementSpec
00493 
00494         tool = self._makeOne()
00495         tool.element_specs = { 'Title' : ElementSpec( 0 )
00496                              , 'Description' : ElementSpec( 0 )
00497                              , 'Subject' : ElementSpec( 1 )
00498                              , 'Format' : ElementSpec( 0 )
00499                              , 'Language' : ElementSpec( 0 )
00500                              , 'Rights' : ElementSpec( 0 )
00501                              }
00502         subj = tool.element_specs[ 'Subject' ]
00503         subj.addPolicy( 'Foo' )
00504         subj.getPolicy( 'Foo' ).edit( False
00505                                     , False
00506                                     , None
00507                                     , True
00508                                     , ( 'bar', 'baz' )
00509                                     )
00510 
00511         dcmi = tool.DCMI
00512 
00513         self.assertEqual( dcmi.getId(), 'DCMI' )
00514 
00515         # Accessing the DCMI property converts and clears 'element_specs'
00516         self.assertRaises(AttributeError, lambda: tool.element_specs )
00517 
00518         subj2 = dcmi.getElementSpec( 'Subject' )
00519         subj_default = subj2.getPolicy( None )
00520         subj_foo = subj2.getPolicy( 'Foo' )
00521 
00522         self.assertEqual( subj_foo.isRequired(), False )
00523         self.assertEqual( subj_foo.supplyDefault(), False )
00524         self.assertEqual( subj_foo.defaultValue(), None )
00525         self.assertEqual( subj_foo.enforceVocabulary(), True )
00526         self.assertEqual( len( subj_foo.allowedVocabulary() ), 2 )
00527         self.failUnless( 'bar' in subj_foo.allowedVocabulary() )
00528         self.failUnless( 'baz' in subj_foo.allowedVocabulary() )
00529 
00530 
00531 def test_suite():
00532     return unittest.TestSuite((
00533         unittest.makeSuite(TestMetadataElementPolicy),
00534         unittest.makeSuite(TestElementSpec),
00535         unittest.makeSuite(TestMetadataTool),
00536         ))
00537 
00538 if __name__ == '__main__':
00539     unittest.main(defaultTest='test_suite')