[Zodb-checkins] CVS: Zope3/src/persistence/tests - test_cache.py:1.5
Jeremy Hylton
jeremy at zope.com
Wed Apr 16 19:06:51 EDT 2003
Update of /cvs-repository/Zope3/src/persistence/tests
In directory cvs.zope.org:/tmp/cvs-serv22387/persistence/tests
Modified Files:
test_cache.py
Log Message:
Update cache clients and implementation to use new ICache interface.
=== Zope3/src/persistence/tests/test_cache.py 1.4 => 1.5 ===
--- Zope3/src/persistence/tests/test_cache.py:1.4 Thu Mar 13 13:48:55 2003
+++ Zope3/src/persistence/tests/test_cache.py Wed Apr 16 18:06:20 2003
@@ -28,7 +28,7 @@
def setstate(self, ob):
ob.__setstate__({'x': 42})
- self.cache.setstate(ob._p_oid, ob)
+ self.cache.activate(ob._p_oid)
class Test(unittest.TestCase):
@@ -37,7 +37,7 @@
p1=P()
p1._p_oid=1
p1._p_jar=dm
- dm.cache[1]=p1
+ dm.cache.set(1, p1)
self.assertEqual(dm.cache.statistics(),
{'ghosts': 0, 'active': 1},
)
@@ -48,12 +48,12 @@
p1=P()
p1._p_oid=1
p1._p_jar=dm
- dm.cache[1]=p1
+ dm.cache.set(1, p1)
self.assertEqual(dm.cache.statistics(),
{'ghosts': 0, 'active': 1},
)
- p=dm.cache[1]
- dm.cache.invalidate(1)
+ p=dm.cache.get(1)
+ dm.cache.invalidate([1])
self.assertEqual(dm.cache.statistics(),
{'ghosts': 1, 'active': 0},
)
@@ -66,7 +66,7 @@
self.assertEqual(dm.cache.statistics(),
{'ghosts': 0, 'active': 1},
)
- dm.cache.invalidateMany([1])
+ dm.cache.invalidate([1])
self.assertEqual(dm.cache.statistics(),
{'ghosts': 1, 'active': 0},
)
@@ -79,7 +79,7 @@
self.assertEqual(dm.cache.statistics(),
{'ghosts': 0, 'active': 1},
)
- dm.cache.invalidateMany(None)
+ dm.cache.clear()
self.assertEqual(dm.cache.statistics(),
{'ghosts': 1, 'active': 0},
)
@@ -94,7 +94,7 @@
{'ghosts': 0, 'active': 1},
)
# No changed because p is modified:
- dm.cache.incrgc()
+ dm.cache.shrink()
self.assertEqual(dm.cache.statistics(),
{'ghosts': 0, 'active': 1},
)
@@ -114,15 +114,15 @@
p1=P()
p1._p_oid=1
p1._p_jar=dm
- dm.cache[1]=p1
+ dm.cache.set(1, p1)
p1.a=1
p1._p_atime=int(time.time()-5000)%86400
- dm.cache.incrgc()
+ dm.cache.shrink()
self.assertEqual(dm.cache.statistics(),
{'ghosts': 0, 'active': 1},
)
p1._p_changed=0
- dm.cache.incrgc()
+ dm.cache.shrink()
self.assertEqual(dm.cache.statistics(),
{'ghosts': 1, 'active': 0},
)
@@ -133,14 +133,13 @@
self.assertEqual(dm.cache.statistics(),
{'ghosts': 0, 'active': 1},
)
- dm.cache.incrgc()
+ dm.cache.shrink()
self.assertEqual(dm.cache.statistics(),
{'ghosts': 1, 'active': 0},
)
def test_suite():
- loader=unittest.TestLoader()
- return loader.loadTestsFromTestCase(Test)
+ return unittest.makeSuite(Test)
-if __name__=='__main__':
- unittest.TextTestRunner().run(test_suite())
+if __name__ == "__main__":
+ unittest.main()
More information about the Zodb-checkins
mailing list