[Zope3-checkins] CVS: Zope3/src/zope/app/container/tests - test_containerdecorator.py:1.1.2.1 test_rename.py:1.4.8.1 test_zopecontaineradpter.py:NONE
Steve Alexander
steve@cat-box.net
Thu, 15 May 2003 10:49:59 -0400
Update of /cvs-repository/Zope3/src/zope/app/container/tests
In directory cvs.zope.org:/tmp/cvs-serv12712/src/zope/app/container/tests
Modified Files:
Tag: stevea-decorators-branch
test_rename.py
Added Files:
Tag: stevea-decorators-branch
test_containerdecorator.py
Removed Files:
Tag: stevea-decorators-branch
test_zopecontaineradpter.py
Log Message:
More work on Decorators.
Converted existing tests to use decorators instead of ZopeContainerAdapter.
=== Added File Zope3/src/zope/app/container/tests/test_containerdecorator.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""XXX short summary goes here.
XXX longer description goes here.
$Id: test_containerdecorator.py,v 1.1.2.1 2003/05/15 14:49:28 stevea Exp $
"""
from unittest import TestCase, TestSuite, main, makeSuite
from zope.app.interfaces.container import IAddNotifiable
from zope.app.interfaces.container import IDeleteNotifiable
from zope.app.container.tests.baseizopeitemcontainer \
import BaseTestIZopeSimpleReadContainer, BaseTestIZopeReadContainer,\
BaseTestIZopeWriteContainer
from zope.app.tests.placelesssetup import PlacelessSetup
from zope.proxy.context import ContextWrapper
class C: pass
class H:
__implements__ = IAddNotifiable, IDeleteNotifiable
notified = 0
def beforeDeleteHook(self, object, container):
self.notified -= 1
def afterAddHook(self, object, container):
self.notified += 1
class Test(PlacelessSetup,
BaseTestIZopeSimpleReadContainer,
BaseTestIZopeReadContainer,
BaseTestIZopeWriteContainer,
TestCase):
def setUp(self):
PlacelessSetup.setUp(self)
from zope.app.container.sample import SampleContainer
self.__container = SampleContainer()
def _sampleMapping(self):
container = self.__container
for k, v in self._sampleDict().items():
container.setObject(k, v)
return ContextWrapper(container, None)
def _sampleContainer(self):
return self.__container
__sample = {'Z': C(), 'O': C(),'P': C()}
def _sampleDict(self):
return self.__sample
def _absentKeys(self):
return 'zc', 'ny'
__newItem = {'A': C(), 'B':C()}
def _sample_newItem(self):
return self.__newItem
__newItemHooked = {'B': H(), 'E':H()}
def _sample_newItemHooked(self):
return self.__newItemHooked
def test_suite():
return TestSuite((
makeSuite(Test),
))
if __name__=='__main__':
main(defaultTest='test_suite')
=== Zope3/src/zope/app/container/tests/test_rename.py 1.4 => 1.4.8.1 ===
--- Zope3/src/zope/app/container/tests/test_rename.py:1.4 Thu May 1 15:35:09 2003
+++ Zope3/src/zope/app/container/tests/test_rename.py Thu May 15 10:49:28 2003
@@ -36,7 +36,7 @@
from zope.app.copypastemove import ObjectMover
from zope.app.content.file import File
from zope.exceptions import NotFoundError, DuplicationError
-from zope.app.container.zopecontainer import ZopeContainerAdapter
+from zope.proxy.context import ContextWrapper
class RenameTest(PlacefulSetup, TestCase):
@@ -48,7 +48,6 @@
provideAdapter(IContainer, IMoveSource, MoveSource)
provideAdapter(None, IObjectName, ObjectName)
provideAdapter(IContainer, IPasteNamesChooser, PasteNamesChooser)
- provideAdapter(IContainer, IZopeContainer, ZopeContainerAdapter)
def test_simplerename(self):
root = self.rootFolder
=== Removed File Zope3/src/zope/app/container/tests/test_zopecontaineradpter.py ===