[Zope-Checkins] CVS: ZODB/src/persistent - wref.py:1.1.2.2
Jeremy Hylton
jeremy at zope.com
Fri Feb 13 11:13:16 EST 2004
Update of /cvs-repository/ZODB/src/persistent
In directory cvs.zope.org:/tmp/cvs-serv11904
Modified Files:
Tag: zope3-zodb3-devel-branch
wref.py
Log Message:
zodb -> ZODB
Allows these tests to pass under ZODB3.
=== ZODB/src/persistent/wref.py 1.1.2.1 => 1.1.2.2 ===
--- ZODB/src/persistent/wref.py:1.1.2.1 Thu Feb 12 15:51:12 2004
+++ ZODB/src/persistent/wref.py Fri Feb 13 11:13:15 2004
@@ -32,7 +32,7 @@
a refernce to it:
>>> import persistent.list
- >>> import zodb.tests.util
+ >>> import ZODB.tests.util
>>> ob = persistent.list.PersistentList()
>>> ref = WeakRef(ob)
>>> ref() is ob
@@ -54,12 +54,12 @@
Lets save the refernce and the refernced object in a database:
- >>> db = zodb.tests.util.DB()
+ >>> db = ZODB.tests.util.DB()
>>> conn1 = db.open()
>>> conn1.root()['ob'] = ob
>>> conn1.root()['ref'] = ref
- >>> zodb.tests.util.commit()
+ >>> ZODB.tests.util.commit()
If we oprn a new connection, sure enough, we can use the reference:
@@ -72,8 +72,8 @@
But if we delete the referenced object and pack:
>>> del conn2.root()['ob']
- >>> zodb.tests.util.commit()
- >>> zodb.tests.util.pack(db)
+ >>> ZODB.tests.util.commit()
+ >>> ZODB.tests.util.pack(db)
And then look in a new connection:
@@ -146,17 +146,17 @@
some persistent objects to it.
>>> d = PersistentWeakKeyDictionary()
- >>> import zodb.tests.util
- >>> p1 = zodb.tests.util.P('p1')
- >>> p2 = zodb.tests.util.P('p2')
- >>> p3 = zodb.tests.util.P('p3')
+ >>> import ZODB.tests.util
+ >>> p1 = ZODB.tests.util.P('p1')
+ >>> p2 = ZODB.tests.util.P('p2')
+ >>> p3 = ZODB.tests.util.P('p3')
>>> d[p1] = 1
>>> d[p2] = 2
>>> d[p3] = 3
We'll create an extra persustent object that's not in the dict:
- >>> p4 = zodb.tests.util.P('p4')
+ >>> p4 = ZODB.tests.util.P('p4')
Now we'll excercise iteration and item access:
@@ -172,14 +172,14 @@
We can add the dict and the refernced objects to a database:
- >>> db = zodb.tests.util.DB()
+ >>> db = ZODB.tests.util.DB()
>>> conn1 = db.open()
>>> conn1.root()['p1'] = p1
>>> conn1.root()['d'] = d
>>> conn1.root()['p2'] = p2
>>> conn1.root()['p3'] = p3
- >>> zodb.tests.util.commit()
+ >>> ZODB.tests.util.commit()
And things still work, as before:
@@ -209,12 +209,12 @@
from the dictionary:
>>> del conn2.root()['p2']
- >>> zodb.tests.util.commit()
+ >>> ZODB.tests.util.commit()
And pack the database, so that the no-longer referenced p2 is
actuallt removed from the database.
- >>> zodb.tests.util.pack(db)
+ >>> ZODB.tests.util.pack(db)
Now if we access the dictionary in a new connection, it no longer
has p2:
More information about the Zope-Checkins
mailing list