[Zope3-checkins] CVS: Zope3/src/zope/app/container/tests - test_icontainer.py:1.3
R. David Murray
bitz@bitdance.com
Fri, 27 Dec 2002 11:00:14 -0500
Update of /cvs-repository/Zope3/src/zope/app/container/tests
In directory cvs.zope.org:/tmp/cvs-serv20116/zope/app/container/tests
Modified Files:
test_icontainer.py
Log Message:
Rename _Test__new to the (now) standard 'makeTestObject' in a couple of
unit tests.
=== Zope3/src/zope/app/container/tests/test_icontainer.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/container/tests/test_icontainer.py:1.2 Wed Dec 25 09:12:47 2002
+++ Zope3/src/zope/app/container/tests/test_icontainer.py Fri Dec 27 10:59:43 2002
@@ -24,12 +24,12 @@
class BaseTestIContainer:
"""Base test cases for containers.
- Subclasses need to define a method, '_Test__new', that
- takes no arguments and that returns a new empty test container.
+ Subclasses must define a makeTestObject that takes no
+ arguments and that returns a new empty test container.
"""
def __setUp(self):
- self.__container = container = self._Test__new()
+ self.__container = container = self.makeTestObject()
for k,v in [('3', '0'), ('2', '1'), ('4', '2'), ('6', '3'), ('0', '4'),
('5', '5'), ('1', '6'), ('8', '7'), ('7', '8'), ('9', '9')]:
container.setObject(k, v)
@@ -39,11 +39,11 @@
# Interface-driven tests:
def testIContainerVerify(self):
- verifyObject(IContainer, self._Test__new())
+ verifyObject(IContainer, self.makeTestObject())
def test_keys(self):
# See interface IReadContainer
- container = self._Test__new()
+ container = self.makeTestObject()
data = container.keys()
self.assertEqual(list(data), [])
@@ -56,7 +56,7 @@
def test_get(self):
# See interface IReadContainer
- container = self._Test__new()
+ container = self.makeTestObject()
self.assertRaises(KeyError, container.__getitem__, '1')
self.assertEqual(container.get('1', '99'), '99')
@@ -70,7 +70,7 @@
def test_values(self):
# See interface IReadContainer
- container = self._Test__new()
+ container = self.makeTestObject()
data = container.values()
self.assertEqual(list(data), [])
@@ -81,7 +81,7 @@
def test_len(self):
# See interface IReadContainer
- container = self._Test__new()
+ container = self.makeTestObject()
self.assertEqual(len(container), 0)
container = self.__setUp()
@@ -89,7 +89,7 @@
def test_items(self):
# See interface IReadContainer
- container = self._Test__new()
+ container = self.makeTestObject()
data = container.items()
self.assertEqual(list(data), [])
@@ -105,7 +105,7 @@
def test___contains__(self):
# See interface IReadContainer
- container = self._Test__new()
+ container = self.makeTestObject()
self.assertEqual(not not ('1' in container), 0)
container = self.__setUp()
@@ -116,7 +116,7 @@
def test_delObject(self):
# See interface IWriteContainer
- container = self._Test__new()
+ container = self.makeTestObject()
self.assertRaises(KeyError, container.__delitem__, '1')
container = self.__setUp()
@@ -134,7 +134,7 @@
# Tests from Folder
def testEmpty(self):
- folder = self._Test__new()
+ folder = self.makeTestObject()
self.failIf(folder.keys())
self.failIf(folder.values())
self.failIf(folder.items())
@@ -147,13 +147,13 @@
self.assertRaises(KeyError, folder.__delitem__, 'foo')
def testBadKeyTypes(self):
- folder = self._Test__new()
+ folder = self.makeTestObject()
value = []
self.assertRaises(TypeError, folder.setObject, None, value)
self.assertRaises(TypeError, folder.setObject, ['foo'], value)
def testOneItem(self):
- folder = self._Test__new()
+ folder = self.makeTestObject()
foo = []
folder.setObject('foo', foo)
@@ -198,7 +198,7 @@
self.assertRaises(KeyError, folder.__delitem__, 'foo')
def testManyItems(self):
- folder = self._Test__new()
+ folder = self.makeTestObject()
objects = [ [0], [1], [2], [3] ]
folder.setObject('foo', objects[0])
folder.setObject('bar', objects[1])
@@ -271,7 +271,7 @@
class Test(BaseTestIContainer, TestCase):
- def _Test__new(self):
+ def makeTestObject(self):
from zope.app.container.sample import SampleContainer
return SampleContainer()