mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-12-01 21:23:43 +03:00
Use ascii_letters instead of letters.
The latter is locale-dependent and not available on Py3.
This commit is contained in:
parent
01565fa6c5
commit
ab5934dc35
|
@ -105,7 +105,7 @@ class CopyTests(unittest.TestCase):
|
||||||
|
|
||||||
def _copy_from(self, curs, nrecs, srec, copykw):
|
def _copy_from(self, curs, nrecs, srec, copykw):
|
||||||
f = StringIO()
|
f = StringIO()
|
||||||
for i, c in izip(xrange(nrecs), cycle(string.letters)):
|
for i, c in izip(xrange(nrecs), cycle(string.ascii_letters)):
|
||||||
l = c * srec
|
l = c * srec
|
||||||
f.write("%s\t%s\n" % (i,l))
|
f.write("%s\t%s\n" % (i,l))
|
||||||
|
|
||||||
|
@ -116,9 +116,9 @@ class CopyTests(unittest.TestCase):
|
||||||
self.assertEqual(nrecs, curs.fetchone()[0])
|
self.assertEqual(nrecs, curs.fetchone()[0])
|
||||||
|
|
||||||
curs.execute("select data from tcopy where id < %s order by id",
|
curs.execute("select data from tcopy where id < %s order by id",
|
||||||
(len(string.letters),))
|
(len(string.ascii_letters),))
|
||||||
for i, (l,) in enumerate(curs):
|
for i, (l,) in enumerate(curs):
|
||||||
self.assertEqual(l, string.letters[i] * srec)
|
self.assertEqual(l, string.ascii_letters[i] * srec)
|
||||||
|
|
||||||
def _copy_to(self, curs, srec):
|
def _copy_to(self, curs, srec):
|
||||||
f = StringIO()
|
f = StringIO()
|
||||||
|
@ -128,11 +128,11 @@ class CopyTests(unittest.TestCase):
|
||||||
ntests = 0
|
ntests = 0
|
||||||
for line in f:
|
for line in f:
|
||||||
n, s = line.split()
|
n, s = line.split()
|
||||||
if int(n) < len(string.letters):
|
if int(n) < len(string.ascii_letters):
|
||||||
self.assertEqual(s, string.letters[int(n)] * srec)
|
self.assertEqual(s, string.ascii_letters[int(n)] * srec)
|
||||||
ntests += 1
|
ntests += 1
|
||||||
|
|
||||||
self.assertEqual(ntests, len(string.letters))
|
self.assertEqual(ntests, len(string.ascii_letters))
|
||||||
|
|
||||||
decorate_all_tests(CopyTests, skip_if_green)
|
decorate_all_tests(CopyTests, skip_if_green)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user