[CMF-checkins] CVS: CMF/CMFSetup/tests - test_utils.py:1.1
test_all.py:1.2
Tres Seaver
tseaver at zope.com
Fri May 14 09:22:44 EDT 2004
Update of /cvs-repository/CMF/CMFSetup/tests
In directory cvs.zope.org:/tmp/cvs-serv9455/tests
Modified Files:
test_all.py
Added Files:
test_utils.py
Log Message:
- registry.py:
o Store the dotted names of handlers, compute the resolved versions
(preliminary for making registries persistent).
- utils.py:
o Make _getDottedName more robust w.r.t. passed values; add tests.
=== Added File CMF/CMFSetup/tests/test_utils.py ===
""" CMFSetup.utils unit tests
$Id: test_utils.py,v 1.1 2004/05/14 13:22:43 tseaver Exp $
"""
import unittest
def _testFunc( *args, **kw ):
""" This is a test.
This is only a test.
"""
_TEST_FUNC_NAME = 'Products.CMFSetup.tests.test_utils._testFunc'
class Whatever:
pass
_WHATEVER_NAME = 'Products.CMFSetup.tests.test_utils.Whatever'
whatever_inst = Whatever()
whatever_inst.__name__ = 'whatever_inst'
_WHATEVER_INST_NAME = 'Products.CMFSetup.tests.test_utils.whatever_inst'
class UtilsTests( unittest.TestCase ):
def test__getDottedName_simple( self ):
from Products.CMFSetup.utils import _getDottedName
self.assertEqual( _getDottedName( _testFunc ), _TEST_FUNC_NAME )
def test__getDottedName_string( self ):
from Products.CMFSetup.utils import _getDottedName
self.assertEqual( _getDottedName( _TEST_FUNC_NAME ), _TEST_FUNC_NAME )
def test__getDottedName_unicode( self ):
from Products.CMFSetup.utils import _getDottedName
dotted = u'%s' % _TEST_FUNC_NAME
self.assertEqual( _getDottedName( dotted ), _TEST_FUNC_NAME )
self.assertEqual( type( _getDottedName( dotted ) ), str )
def test__getDottedName_class( self ):
from Products.CMFSetup.utils import _getDottedName
self.assertEqual( _getDottedName( Whatever ), _WHATEVER_NAME )
def test__getDottedName_inst( self ):
from Products.CMFSetup.utils import _getDottedName
self.assertEqual( _getDottedName( whatever_inst )
, _WHATEVER_INST_NAME )
def test__getDottedName_noname( self ):
from Products.CMFSetup.utils import _getDottedName
class Doh:
pass
doh = Doh()
self.assertRaises( ValueError, _getDottedName, doh )
def test_suite():
return unittest.TestSuite((
unittest.makeSuite( UtilsTests ),
))
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
=== CMF/CMFSetup/tests/test_all.py 1.1 => 1.2 ===
--- CMF/CMFSetup/tests/test_all.py:1.1 Tue May 11 21:35:49 2004
+++ CMF/CMFSetup/tests/test_all.py Fri May 14 09:22:43 2004
@@ -14,7 +14,7 @@
def suite():
return build_test_suite( 'Products.CMFSetup.tests'
, [ 'test_registry'
- ,
+ , 'test_utils'
]
)
More information about the CMF-checkins
mailing list