Commit 29080bf4 authored by Tres Seaver's avatar Tres Seaver

Add overlooked test; fix up import issues.

parent 0707db25
...@@ -27,6 +27,7 @@ def test_weakrefs_functional(): ...@@ -27,6 +27,7 @@ def test_weakrefs_functional():
Here's an example. We'll start by creating a persistent object and Here's an example. We'll start by creating a persistent object and
a reference to it: a reference to it:
>>> import transaction
>>> from persistent.wref import WeakRef >>> from persistent.wref import WeakRef
>>> import persistent, ZODB.tests.MinPO >>> import persistent, ZODB.tests.MinPO
>>> import ZODB.tests.util >>> import ZODB.tests.util
...@@ -162,6 +163,7 @@ def test_PersistentWeakKeyDictionary(): ...@@ -162,6 +163,7 @@ def test_PersistentWeakKeyDictionary():
We'll start by creating a PersistentWeakKeyDictionary and adding We'll start by creating a PersistentWeakKeyDictionary and adding
some persistent objects to it. some persistent objects to it.
>>> import transaction
>>> from persistent.wref import PersistentWeakKeyDictionary >>> from persistent.wref import PersistentWeakKeyDictionary
>>> d = PersistentWeakKeyDictionary() >>> d = PersistentWeakKeyDictionary()
>>> import ZODB.tests.util >>> import ZODB.tests.util
...@@ -254,6 +256,20 @@ def test_PersistentWeakKeyDictionary(): ...@@ -254,6 +256,20 @@ def test_PersistentWeakKeyDictionary():
""" """
def test_PersistentWeakKeyDictionary_get():
"""
>>> import ZODB.tests.util
>>> from persistent.wref import PersistentWeakKeyDictionary
>>> key = ZODB.tests.util.P("key")
>>> missing = ZODB.tests.util.P("missing")
>>> d = PersistentWeakKeyDictionary([(key, 1)])
>>> d.get(key)
1
>>> d.get(missing)
>>> d.get(missing, 12)
12
"""
def test_suite(): def test_suite():
from doctest import DocTestSuite from doctest import DocTestSuite
return DocTestSuite() return DocTestSuite()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment