[Zope-CVS] CVS: Products/BTreeFolder2/tests - testBTreeFolder2.py:1.4
Shane Hathaway
shane@cvs.zope.org
Fri, 10 May 2002 10:52:15 -0400
Update of /cvs-repository/Products/BTreeFolder2/tests
In directory cvs.zope.org:/tmp/cvs-serv19321/tests
Modified Files:
testBTreeFolder2.py
Log Message:
CMF needs the meta type index after all. Added _mt_index and a test.
=== Products/BTreeFolder2/tests/testBTreeFolder2.py 1.3 => 1.4 ===
self.assertEqual(len(self.ff), 0)
- def testIds(self):
+ def testObjectIds(self):
self.assertEqual(list(self.f.objectIds()), ['item'])
self.assertEqual(list(self.f.keys()), ['item'])
self.assertEqual(list(self.ff.objectIds()), [])
@@ -52,14 +52,28 @@
lst.sort()
self.assertEqual(lst, ['item', 'item3'])
- def testValues(self):
+ def testObjectIdsWithMetaType(self):
+ f2 = Folder()
+ f2.id = 'subfolder'
+ self.f._setOb(f2.id, f2)
+ mt1 = BTreeFolder2.meta_type
+ mt2 = Folder.meta_type
+ self.assertEqual(list(self.f.objectIds(mt1)), ['item'])
+ self.assertEqual(list(self.f.objectIds((mt1,))), ['item'])
+ self.assertEqual(list(self.f.objectIds(mt2)), ['subfolder'])
+ lst = list(self.f.objectIds([mt1, mt2]))
+ lst.sort()
+ self.assertEqual(lst, ['item', 'subfolder'])
+ self.assertEqual(list(self.f.objectIds('blah')), [])
+
+ def testObjectValues(self):
values = self.f.objectValues()
self.assertEqual(len(values), 1)
self.assertEqual(values[0].id, 'item')
# Make sure the object is wrapped.
self.assert_(values[0] is not aq_base(values[0]))
- def testItems(self):
+ def testObjectItems(self):
items = self.f.objectItems()
self.assertEqual(len(items), 1)
id, val = items[0]