diff options
Diffstat (limited to 'Lib/bsddb')
-rw-r--r-- | Lib/bsddb/dbrecio.py | 4 | ||||
-rw-r--r-- | Lib/bsddb/dbtables.py | 10 | ||||
-rw-r--r-- | Lib/bsddb/test/test_associate.py | 4 | ||||
-rw-r--r-- | Lib/bsddb/test/test_basics.py | 8 | ||||
-rw-r--r-- | Lib/bsddb/test/test_dbtables.py | 2 |
5 files changed, 14 insertions, 14 deletions
diff --git a/Lib/bsddb/dbrecio.py b/Lib/bsddb/dbrecio.py index 470fb41..22e382a 100644 --- a/Lib/bsddb/dbrecio.py +++ b/Lib/bsddb/dbrecio.py @@ -164,10 +164,10 @@ def _test(): f.seek(len(lines[0])) f.write(lines[1]) f.seek(0) - print 'First line =', `f.readline()` + print 'First line =', repr(f.readline()) here = f.tell() line = f.readline() - print 'Second line =', `line` + print 'Second line =', repr(line) f.seek(-len(line), 1) line2 = f.read(len(line)) if line != line2: diff --git a/Lib/bsddb/dbtables.py b/Lib/bsddb/dbtables.py index 6edfd29..e1d2c43 100644 --- a/Lib/bsddb/dbtables.py +++ b/Lib/bsddb/dbtables.py @@ -206,7 +206,7 @@ class bsdTableDB : try: key, data = cur.first() while 1: - print `{key: data}` + print repr({key: data}) next = cur.next() if next: key, data = next @@ -341,9 +341,9 @@ class bsdTableDB : try: tcolpickles = self.db.get(_columns_key(table)) except DBNotFoundError: - raise TableDBError, "unknown table: " + `table` + raise TableDBError, "unknown table: %r" % (table,) if not tcolpickles: - raise TableDBError, "unknown table: " + `table` + raise TableDBError, "unknown table: %r" % (table,) self.__tablecolumns[table] = pickle.loads(tcolpickles) def __new_rowid(self, table, txn) : @@ -384,7 +384,7 @@ class bsdTableDB : self.__load_column_info(table) for column in rowdict.keys() : if not self.__tablecolumns[table].count(column): - raise TableDBError, "unknown column: "+`column` + raise TableDBError, "unknown column: %r" % (column,) # get a unique row identifier for this row txn = self.env.txn_begin() @@ -535,7 +535,7 @@ class bsdTableDB : columns = self.tablecolumns[table] for column in (columns + conditions.keys()): if not self.__tablecolumns[table].count(column): - raise TableDBError, "unknown column: "+`column` + raise TableDBError, "unknown column: %r" % (column,) # keyed on rows that match so far, containings dicts keyed on # column names containing the data for that row and column. diff --git a/Lib/bsddb/test/test_associate.py b/Lib/bsddb/test/test_associate.py index f810eb0..fc92c22 100644 --- a/Lib/bsddb/test/test_associate.py +++ b/Lib/bsddb/test/test_associate.py @@ -200,7 +200,7 @@ class AssociateTestCase(unittest.TestCase): def getGenre(self, priKey, priData): assert type(priData) == type("") if verbose: - print 'getGenre key:', `priKey`, 'data:', `priData` + print 'getGenre key: %r data: %r' % (priKey, priData) genre = string.split(priData, '|')[2] if genre == 'Blues': return db.DB_DONOTINDEX @@ -242,7 +242,7 @@ class ShelveAssociateTestCase(AssociateTestCase): def getGenre(self, priKey, priData): assert type(priData) == type(()) if verbose: - print 'getGenre key:', `priKey`, 'data:', `priData` + print 'getGenre key: %r data: %r' % (priKey, priData) genre = priData[2] if genre == 'Blues': return db.DB_DONOTINDEX diff --git a/Lib/bsddb/test/test_basics.py b/Lib/bsddb/test/test_basics.py index d757b34..da7e18f 100644 --- a/Lib/bsddb/test/test_basics.py +++ b/Lib/bsddb/test/test_basics.py @@ -361,7 +361,7 @@ class BasicTestCase(unittest.TestCase): if set_raises_error: self.fail("expected exception") if n != None: - self.fail("expected None: "+`n`) + self.fail("expected None: %r" % (n,)) rec = c.get_both('0404', self.makeData('0404')) assert rec == ('0404', self.makeData('0404')) @@ -375,7 +375,7 @@ class BasicTestCase(unittest.TestCase): if get_raises_error: self.fail("expected exception") if n != None: - self.fail("expected None: "+`n`) + self.fail("expected None: %r" % (n,)) if self.d.get_type() == db.DB_BTREE: rec = c.set_range('011') @@ -548,7 +548,7 @@ class BasicTestCase(unittest.TestCase): num = d.truncate() assert num >= 1, "truncate returned <= 0 on non-empty database" num = d.truncate() - assert num == 0, "truncate on empty DB returned nonzero (%s)" % `num` + assert num == 0, "truncate on empty DB returned nonzero (%r)" % (num,) #---------------------------------------------------------------------- @@ -674,7 +674,7 @@ class BasicTransactionTestCase(BasicTestCase): num = d.truncate(txn) assert num >= 1, "truncate returned <= 0 on non-empty database" num = d.truncate(txn) - assert num == 0, "truncate on empty DB returned nonzero (%s)" % `num` + assert num == 0, "truncate on empty DB returned nonzero (%r)" % (num,) txn.commit() #---------------------------------------- diff --git a/Lib/bsddb/test/test_dbtables.py b/Lib/bsddb/test/test_dbtables.py index eb5758f..1128a5a 100644 --- a/Lib/bsddb/test/test_dbtables.py +++ b/Lib/bsddb/test/test_dbtables.py @@ -109,7 +109,7 @@ class TableDBTestCase(unittest.TestCase): assert values[1]['Species'] == 'Penguin' else : if verbose: - print "values=", `values` + print "values= %r" % (values,) raise "Wrong values returned!" def test03(self): |