[Zope-Checkins] CVS: Zope/lib/python/Products/ZCatalog/tests -
testCatalog.py:1.23
Chris McDonough
chrism at zope.com
Sun Oct 5 10:08:13 EDT 2003
Update of /cvs-repository/Zope/lib/python/Products/ZCatalog/tests
In directory cvs.zope.org:/tmp/cvs-serv23048/tests
Modified Files:
testCatalog.py
Log Message:
Merge 'dont-update-metadata' fix from 2.6 branch. When the caller specifies that only a particular set of indexes should be updated, don't update the object metadata unconditionally.
=== Zope/lib/python/Products/ZCatalog/tests/testCatalog.py 1.22 => 1.23 ===
--- Zope/lib/python/Products/ZCatalog/tests/testCatalog.py:1.22 Fri Jan 31 10:54:17 2003
+++ Zope/lib/python/Products/ZCatalog/tests/testCatalog.py Sun Oct 5 10:08:12 2003
@@ -174,6 +174,23 @@
sr = self._catalog.search(query)
self.assertEqual(len(sr), 3)
+
+class dummy(ExtensionClass.Base):
+ att1 = 'att1'
+ att2 = 'att2'
+ att3 = ['att3']
+ def __init__(self, num):
+ self.num = num
+
+ def col1(self):
+ return 'col1'
+
+ def col2(self):
+ return 'col2'
+
+ def col3(self):
+ return ['col3']
+
class TestCatalogObject(unittest.TestCase):
upper = 1000
@@ -215,23 +232,6 @@
self._catalog.addColumn('att3')
self._catalog.addColumn('num')
- class dummy(ExtensionClass.Base):
- att1 = 'att1'
- att2 = 'att2'
- att3 = ['att3']
- def __init__(self, num):
- self.num = num
-
- def col1(self):
- return 'col1'
-
- def col2(self):
- return 'col2'
-
- def col3(self):
- return ['col3']
-
-
for x in range(0, self.upper):
self._catalog.catalogObject(dummy(self.nums[x]), `x`)
self._catalog.aq_parent = dummy('foo') # fake out acquisition
@@ -404,6 +404,19 @@
self.assertEqual(a.actual_result_count, self.upper)
self.assertEqual(a[0].num, self.upper - 1)
+ def testUpdateIndexLeavesMetadataAlone(self):
+ ob = dummy(9999)
+ self._catalog.catalogObject(ob, `9999`)
+ brain = self._catalog(num=9999)[0]
+ self.assertEqual(brain.att1, 'att1')
+ ob.att1 = 'foobar'
+ self._catalog.catalogObject(ob, `9999`, idxs=['num'])
+ brain = self._catalog(num=9999)[0]
+ self.assertEqual(brain.att1, 'att1')
+ self._catalog.catalogObject(ob, `9999`)
+ brain = self._catalog(num=9999)[0]
+ self.assertEqual(brain.att1, 'foobar')
+
class objRS(ExtensionClass.Base):
More information about the Zope-Checkins
mailing list