Commit 169f195b authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #22943: bsddb tests are locale independend now.

This fixes tests on 8-bit locales (in particular on Windows).
parent d5355178
......@@ -412,9 +412,6 @@ if sys.version_info[0] >= 3 :
def get_dbp(self) :
return self._db
import string
string.letters=[chr(i) for i in xrange(65,91)]
bsddb._db.DBEnv_orig = bsddb._db.DBEnv
bsddb._db.DB_orig = bsddb._db.DB
if bsddb.db.version() <= (4, 3) :
......
......@@ -999,7 +999,7 @@ class BasicMultiDBTestCase(BasicTestCase):
for x in "The quick brown fox jumped over the lazy dog".split():
d2.put(x, self.makeData(x))
for x in string.letters:
for x in string.ascii_letters:
d3.put(x, x*70)
d1.sync()
......@@ -1047,7 +1047,7 @@ class BasicMultiDBTestCase(BasicTestCase):
if verbose:
print rec
rec = c3.next()
self.assertEqual(count, len(string.letters))
self.assertEqual(count, len(string.ascii_letters))
c1.close()
......
......@@ -59,7 +59,7 @@ class DBShelveTestCase(unittest.TestCase):
return bytes(key, "iso8859-1") # 8 bits
def populateDB(self, d):
for x in string.letters:
for x in string.ascii_letters:
d[self.mk('S' + x)] = 10 * x # add a string
d[self.mk('I' + x)] = ord(x) # add an integer
d[self.mk('L' + x)] = [x] * 10 # add a list
......
......@@ -26,14 +26,14 @@ class GetReturnsNoneTestCase(unittest.TestCase):
d.open(self.filename, db.DB_BTREE, db.DB_CREATE)
d.set_get_returns_none(1)
for x in string.letters:
for x in string.ascii_letters:
d.put(x, x * 40)
data = d.get('bad key')
self.assertEqual(data, None)
data = d.get(string.letters[0])
self.assertEqual(data, string.letters[0]*40)
data = d.get(string.ascii_letters[0])
self.assertEqual(data, string.ascii_letters[0]*40)
count = 0
c = d.cursor()
......@@ -43,7 +43,7 @@ class GetReturnsNoneTestCase(unittest.TestCase):
rec = c.next()
self.assertEqual(rec, None)
self.assertEqual(count, len(string.letters))
self.assertEqual(count, len(string.ascii_letters))
c.close()
d.close()
......@@ -54,14 +54,14 @@ class GetReturnsNoneTestCase(unittest.TestCase):
d.open(self.filename, db.DB_BTREE, db.DB_CREATE)
d.set_get_returns_none(0)
for x in string.letters:
for x in string.ascii_letters:
d.put(x, x * 40)
self.assertRaises(db.DBNotFoundError, d.get, 'bad key')
self.assertRaises(KeyError, d.get, 'bad key')
data = d.get(string.letters[0])
self.assertEqual(data, string.letters[0]*40)
data = d.get(string.ascii_letters[0])
self.assertEqual(data, string.ascii_letters[0]*40)
count = 0
exceptionHappened = 0
......@@ -77,7 +77,7 @@ class GetReturnsNoneTestCase(unittest.TestCase):
self.assertNotEqual(rec, None)
self.assertTrue(exceptionHappened)
self.assertEqual(count, len(string.letters))
self.assertEqual(count, len(string.ascii_letters))
c.close()
d.close()
......
......@@ -10,7 +10,6 @@ from test_all import db, verbose, get_new_database_path
#----------------------------------------------------------------------
@unittest.skip("fails on Windows; see issue 22943")
class SimpleQueueTestCase(unittest.TestCase):
def setUp(self):
self.filename = get_new_database_path()
......@@ -37,17 +36,17 @@ class SimpleQueueTestCase(unittest.TestCase):
print "before appends" + '-' * 30
pprint(d.stat())
for x in string.letters:
for x in string.ascii_letters:
d.append(x * 40)
self.assertEqual(len(d), len(string.letters))
self.assertEqual(len(d), len(string.ascii_letters))
d.put(100, "some more data")
d.put(101, "and some more ")
d.put(75, "out of order")
d.put(1, "replacement data")
self.assertEqual(len(d), len(string.letters)+3)
self.assertEqual(len(d), len(string.ascii_letters)+3)
if verbose:
print "before close" + '-' * 30
......@@ -108,17 +107,17 @@ class SimpleQueueTestCase(unittest.TestCase):
print "before appends" + '-' * 30
pprint(d.stat())
for x in string.letters:
for x in string.ascii_letters:
d.append(x * 40)
self.assertEqual(len(d), len(string.letters))
self.assertEqual(len(d), len(string.ascii_letters))
d.put(100, "some more data")
d.put(101, "and some more ")
d.put(75, "out of order")
d.put(1, "replacement data")
self.assertEqual(len(d), len(string.letters)+3)
self.assertEqual(len(d), len(string.ascii_letters)+3)
if verbose:
print "before close" + '-' * 30
......
......@@ -4,12 +4,11 @@
import os, sys
import errno
from pprint import pprint
import string
import unittest
from test_all import db, test_support, verbose, get_new_environment_path, get_new_database_path
letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
#----------------------------------------------------------------------
......@@ -39,7 +38,7 @@ class SimpleRecnoTestCase(unittest.TestCase):
d.open(self.filename, db.DB_RECNO, db.DB_CREATE)
for x in letters:
for x in string.ascii_letters:
recno = d.append(x * 60)
self.assertIsInstance(recno, int)
self.assertGreaterEqual(recno, 1)
......@@ -270,7 +269,7 @@ class SimpleRecnoTestCase(unittest.TestCase):
d.set_re_pad(45) # ...test both int and char
d.open(self.filename, db.DB_RECNO, db.DB_CREATE)
for x in letters:
for x in string.ascii_letters:
d.append(x * 35) # These will be padded
d.append('.' * 40) # this one will be exact
......
......@@ -30,6 +30,11 @@ Tools/Demos
- Issue #18905: "pydoc -p 0" now outputs actually used port. Based on patch by
Wieland Hoffmann.
Tests
-----
- Issue #22943: bsddb tests are locale independend now.
What's New in Python 2.7.9?
===========================
......
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