[Zope-Checkins] CVS: Zope3/lib/python/Zope/ComponentArchitecture/tests - testAPI.py:1.1.2.4
Jim Fulton
jim@zope.com
Tue, 20 Nov 2001 17:23:30 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/ComponentArchitecture/tests
In directory cvs.zope.org:/tmp/cvs-serv28279
Modified Files:
Tag: Zope-3x-branch
testAPI.py
Log Message:
Fixed tests to match new API.
=== Zope3/lib/python/Zope/ComponentArchitecture/tests/testAPI.py 1.1.2.3 => 1.1.2.4 ===
def testFeature(self):
from Zope.ComponentArchitecture import getFeature, provideFeature
+ from Zope.ComponentArchitecture.Exceptions import ComponentLookupError
self.assertEquals(getFeature(ob, I1), ob)
- self.assertEquals(getFeature(ob, I2), None)
+ self.assertRaises(ComponentLookupError, getFeature, ob, I2)
self.assertEquals(getFeature(ob, I2, Test), Test)
provideFeature(I1, I2, Comp)
@@ -36,9 +37,10 @@
def testUtility(self):
from Zope.ComponentArchitecture import getUtility, provideUtility
+ from Zope.ComponentArchitecture.Exceptions import ComponentLookupError
- self.assertNotEquals(getUtility(ob, I1), ob)
- self.assertEquals(getUtility(ob, I2), None)
+ self.assertRaises(ComponentLookupError, getUtility, ob, I1)
+ self.assertRaises(ComponentLookupError, getUtility, ob, I2)
self.assertEquals(getUtility(ob, I2, Test), Test)
provideUtility(I2, comp)
@@ -47,9 +49,10 @@
def testPresentation(self):
from Zope.ComponentArchitecture import providePresentation
from Zope.ComponentArchitecture import getPresentation
+ from Zope.ComponentArchitecture.Exceptions import ComponentLookupError
- self.assertNotEquals(getPresentation(ob, 'foo', I1), ob)
- self.assertEquals(getPresentation(ob, 'foo', I2), None)
+ self.assertRaises(ComponentLookupError, getPresentation, ob, 'foo', I1)
+ self.assertRaises(ComponentLookupError, getPresentation, ob, 'foo', I2)
self.assertEquals(getPresentation(ob, 'foo', I2, Test), Test)
providePresentation(I1, 'foo', I2, Comp)
@@ -57,8 +60,10 @@
self.assertEquals(c.__class__, Comp)
self.assertEquals(c.getContext(), ob)
- self.assertNotEquals(getPresentation(ob, 'foo2', I1), ob)
- self.assertEquals(getPresentation(ob, 'foo2', I2), None)
+ self.assertRaises(ComponentLookupError,
+ getPresentation, ob, 'foo2', I1)
+ self.assertRaises(ComponentLookupError,
+ getPresentation, ob, 'foo2', I2)
self.assertEquals(getPresentation(ob, 'foo2', I2, Test), Test)
def test_suite():