[Zope3-checkins] CVS: Zope3/src/zope/interface/tests - test_type.py:1.5
Steve Alexander
steve@cat-box.net
Fri, 31 Jan 2003 11:22:06 -0500
Update of /cvs-repository/Zope3/src/zope/interface/tests
In directory cvs.zope.org:/tmp/cvs-serv11586/tests
Modified Files:
test_type.py
Log Message:
added __len__ method to the type registry
=== Zope3/src/zope/interface/tests/test_type.py 1.4 => 1.5 ===
--- Zope3/src/zope/interface/tests/test_type.py:1.4 Thu Jan 30 08:38:43 2003
+++ Zope3/src/zope/interface/tests/test_type.py Fri Jan 31 11:22:03 2003
@@ -42,8 +42,10 @@
class I3(I2): pass
reg = self.new_instance()
+ self.assertEqual(len(reg), 0)
reg.register(I2, 2)
+ self.assertEqual(len(reg), 1)
self.assertEqual(getTypesMatching(reg, None), [I2])
self.assertEqual(getTypesMatching(reg, Interface), [I2])
self.assertEqual(getTypesMatching(reg, I1), [I2])
@@ -65,6 +67,7 @@
self.assertEqual(reg.get(I3), None)
reg.register(I1, 1)
+ self.assertEqual(len(reg), 2)
self.assertEqual(getTypesMatching(reg, None), [I1, I2])
self.assertEqual(getTypesMatching(reg, Interface), [I1, I2])
self.assertEqual(getTypesMatching(reg, I1), [I1, I2])
@@ -81,6 +84,7 @@
self.assertEqual(reg.get(I3), None)
reg.register(I3, 3)
+ self.assertEqual(len(reg), 3)
self.assertEqual(getTypesMatching(reg, None), [I1, I2, I3])
self.assertEqual(getTypesMatching(reg, Interface), [I1, I2, I3])
self.assertEqual(getTypesMatching(reg, I1), [I1, I2, I3])
@@ -97,6 +101,7 @@
self.assertEqual(reg.get(I3), 3)
reg.unregister(I3)
+ self.assertEqual(len(reg), 2)
self.assertEqual(getTypesMatching(reg, None), [I1, I2])
self.assertEqual(getTypesMatching(reg, Interface), [I1, I2])
self.assertEqual(getTypesMatching(reg, I1), [I1, I2])