mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	Add a unit test for bug fix #1396678.
This commit is contained in:
		
							parent
							
								
									26caeba35a
								
							
						
					
					
						commit
						19e2203fff
					
				
					 2 changed files with 11 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -111,11 +111,10 @@ def __iter__(self):
 | 
			
		|||
            return
 | 
			
		||||
 | 
			
		||||
    def iteritems(self):
 | 
			
		||||
        if not self.db:
 | 
			
		||||
            return
 | 
			
		||||
        try:
 | 
			
		||||
            try:
 | 
			
		||||
                cur = self._make_iter_cursor()
 | 
			
		||||
            except AttributeError:
 | 
			
		||||
                return
 | 
			
		||||
            cur = self._make_iter_cursor()
 | 
			
		||||
 | 
			
		||||
            # FIXME-20031102-greg: race condition.  cursor could
 | 
			
		||||
            # be closed by another thread before this call.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,10 +7,10 @@
 | 
			
		|||
 | 
			
		||||
try:
 | 
			
		||||
    # For Pythons w/distutils pybsddb
 | 
			
		||||
    from bsddb3 import db, dbshelve
 | 
			
		||||
    from bsddb3 import db, dbshelve, hashopen
 | 
			
		||||
except ImportError:
 | 
			
		||||
    # For Python 2.3
 | 
			
		||||
    from bsddb import db, dbshelve
 | 
			
		||||
    from bsddb import db, dbshelve, hashopen
 | 
			
		||||
 | 
			
		||||
#----------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -46,6 +46,12 @@ def test02_db_home(self):
 | 
			
		|||
        env.open(self.homeDir, db.DB_CREATE)
 | 
			
		||||
        assert self.homeDir == env.db_home
 | 
			
		||||
 | 
			
		||||
    def test03_repr_closed_db(self):
 | 
			
		||||
        db = hashopen(self.filename)
 | 
			
		||||
        db.close()
 | 
			
		||||
        rp = repr(db)
 | 
			
		||||
        self.assertEquals(rp, "{}")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#----------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue