Kaydet (Commit) 19e2203f authored tarafından Georg Brandl's avatar Georg Brandl

Add a unit test for bug fix #1396678.

üst 26caeba3
...@@ -111,11 +111,10 @@ class _iter_mixin(UserDict.DictMixin): ...@@ -111,11 +111,10 @@ class _iter_mixin(UserDict.DictMixin):
return return
def iteritems(self): def iteritems(self):
if not self.db:
return
try: try:
try: cur = self._make_iter_cursor()
cur = self._make_iter_cursor()
except AttributeError:
return
# FIXME-20031102-greg: race condition. cursor could # FIXME-20031102-greg: race condition. cursor could
# be closed by another thread before this call. # be closed by another thread before this call.
......
...@@ -7,10 +7,10 @@ import unittest ...@@ -7,10 +7,10 @@ import unittest
try: try:
# For Pythons w/distutils pybsddb # For Pythons w/distutils pybsddb
from bsddb3 import db, dbshelve from bsddb3 import db, dbshelve, hashopen
except ImportError: except ImportError:
# For Python 2.3 # For Python 2.3
from bsddb import db, dbshelve from bsddb import db, dbshelve, hashopen
#---------------------------------------------------------------------- #----------------------------------------------------------------------
...@@ -46,6 +46,12 @@ class MiscTestCase(unittest.TestCase): ...@@ -46,6 +46,12 @@ class MiscTestCase(unittest.TestCase):
env.open(self.homeDir, db.DB_CREATE) env.open(self.homeDir, db.DB_CREATE)
assert self.homeDir == env.db_home assert self.homeDir == env.db_home
def test03_repr_closed_db(self):
db = hashopen(self.filename)
db.close()
rp = repr(db)
self.assertEquals(rp, "{}")
#---------------------------------------------------------------------- #----------------------------------------------------------------------
......
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