|
2 | 2 | TestCases for DB.associate. |
3 | 3 | """ |
4 | 4 |
|
5 | | -import sys, os, string |
| 5 | +import sys, os |
6 | 6 | import tempfile |
7 | 7 | import time |
8 | 8 | from pprint import pprint |
@@ -177,7 +177,7 @@ def addDataToDB(self, d, txn=None): |
177 | 177 | for key, value in musicdata.items(): |
178 | 178 | if type(self.keytype) == type(''): |
179 | 179 | key = "%02d" % key |
180 | | - d.put(key, string.join(value, '|'), txn=txn) |
| 180 | + d.put(key, '|'.join(value), txn=txn) |
181 | 181 |
|
182 | 182 | def createDB(self, txn=None): |
183 | 183 | self.cur = None |
@@ -263,7 +263,7 @@ def finish_test(self, secDB, txn=None): |
263 | 263 | rec = self.cur.first() |
264 | 264 | while rec is not None: |
265 | 265 | if type(self.keytype) == type(''): |
266 | | - assert string.atoi(rec[0]) # for primary db, key is a number |
| 266 | + assert int(rec[0]) # for primary db, key is a number |
267 | 267 | else: |
268 | 268 | assert rec[0] and type(rec[0]) == type(0) |
269 | 269 | count = count + 1 |
@@ -305,7 +305,7 @@ def getGenre(self, priKey, priData): |
305 | 305 | assert type(priData) == type("") |
306 | 306 | if verbose: |
307 | 307 | print('getGenre key: %r data: %r' % (priKey, priData)) |
308 | | - genre = string.split(priData, '|')[2] |
| 308 | + genre = priData.split('|')[2] |
309 | 309 | if genre == 'Blues': |
310 | 310 | return db.DB_DONOTINDEX |
311 | 311 | else: |
@@ -427,13 +427,13 @@ def writer1(self, d): |
427 | 427 | for key, value in musicdata.items(): |
428 | 428 | if type(self.keytype) == type(''): |
429 | 429 | key = "%02d" % key |
430 | | - d.put(key, string.join(value, '|')) |
| 430 | + d.put(key, '|'.join(value)) |
431 | 431 |
|
432 | 432 | def writer2(self, d): |
433 | 433 | for x in range(100, 600): |
434 | 434 | key = 'z%2d' % x |
435 | 435 | value = [key] * 4 |
436 | | - d.put(key, string.join(value, '|')) |
| 436 | + d.put(key, '|'.join(value)) |
437 | 437 |
|
438 | 438 |
|
439 | 439 | class ThreadedAssociateHashTestCase(ShelveAssociateTestCase): |
|
0 commit comments