[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/PropertySets/tests - PropertySetDef.py:1.3 testPropertySetDef.py:1.3
Jeremy Hylton
jeremy@zope.com
Tue, 16 Jul 2002 18:54:03 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/PropertySets/tests
In directory cvs.zope.org:/tmp/cvs-serv9457/tests
Modified Files:
PropertySetDef.py testPropertySetDef.py
Log Message:
Cleanup tests:
Remove unused unittest boilerplate.
Use full path in import rather than implicit one, which caused some
extra confusion because the tests package and the parent have a module
with the same name.
Rename the test class in PropertySetDef to be explicit about its
purpose. This eliminates the name for an import as in the unittest.
=== Zope3/lib/python/Zope/App/OFS/PropertySets/tests/PropertySetDef.py 1.2 => 1.3 ===
from Zope.App.OFS.PropertySets.IPropertySetDef import IPropertySetDef
from Zope.Exceptions import DuplicationError
-class Field: pass
+class Field:
+ pass
-class PropertySetDef:
+class PropertySetDefTest:
"Test the IPropertySetDef interface"
def setUp(self):
self.field1 = Field()
self.field2 = Field()
- self.psd.addField('test1',self.field1)
- self.psd.addField('test2',self.field2)
+ self.psd.addField('test1', self.field1)
+ self.psd.addField('test2', self.field2)
def testInterfaceVerifies(self):
- verifyObject(IPropertySetDef,self.psd)
+ verifyObject(IPropertySetDef, self.psd)
def testStorage(self):
"""test __getitem__"""
- self.failUnlessEqual(self.field1,self.psd.getField('test1'))
+ self.failUnlessEqual(self.field1, self.psd.getField('test1'))
def testGetitemException(self):
"""test getField raises exception on unknown key"""
- self.assertRaises(KeyError,self.psd.getField,'randomkey')
+ self.assertRaises(KeyError, self.psd.getField, 'randomkey')
def testHas_field(self):
- self.failUnlessEqual(1,self.psd.has_field('test1'))
- self.failUnlessEqual(1,self.psd.has_field('test2'))
+ self.failUnlessEqual(1, self.psd.has_field('test1'))
+ self.failUnlessEqual(1, self.psd.has_field('test2'))
def testfieldNames(self):
- self.failUnlessEqual(['test1','test2'],self.psd.fieldNames())
+ self.failUnlessEqual(['test1', 'test2'], self.psd.fieldNames())
def testIter(self):
- self.failUnlessEqual([self.field1,self.field2],
- list(self.psd.__iter__()))
+ self.failUnlessEqual([self.field1, self.field2], list(self.psd))
def testLen(self):
- self.failUnlessEqual(len(self.psd),2)
+ self.failUnlessEqual(len(self.psd), 2)
def testAddDupField(self):
- self.assertRaises(DuplicationError,self.psd.addField,'test1',None)
+ self.assertRaises(DuplicationError, self.psd.addField, 'test1', None)
=== Zope3/lib/python/Zope/App/OFS/PropertySets/tests/testPropertySetDef.py 1.2 => 1.3 ===
$Id$
"""
-from unittest import TestCase, TestSuite, main, makeSuite
-from Zope.Testing.CleanUp import CleanUp # Base class w registry cleanup
-from PropertySetDef import PropertySetDef as PropertySetDefTestClass
+from unittest import TestCase, main, makeSuite
+from Zope.App.OFS.PropertySets.tests.PropertySetDef \
+ import PropertySetDefTest
from Zope.App.OFS.PropertySets.PropertySetDef import PropertySetDef
-class Field: pass
+class Field:
+ pass
-class Test(CleanUp, PropertySetDefTestClass, TestCase):
+class Test(PropertySetDefTest, TestCase, object):
def setUp(self):
self.psd = PropertySetDef()
- #super(Test,self).setUp()
- PropertySetDefTestClass.setUp(self)
- CleanUp.setUp(self)
-
+ super(Test, self).setUp()
def test_suite():
- return TestSuite((
- makeSuite(Test),
- ))
+ return makeSuite(Test)
if __name__=='__main__':
main(defaultTest='test_suite')