mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-12 07:10:33 +03:00
- Tabs fixed.
This commit is contained in:
parent
70e555585e
commit
a6ea092acc
|
@ -31,7 +31,7 @@ class TypesBasicTests(TestCase):
|
||||||
curs = self.conn.cursor()
|
curs = self.conn.cursor()
|
||||||
curs.execute(*args)
|
curs.execute(*args)
|
||||||
return curs.fetchone()[0]
|
return curs.fetchone()[0]
|
||||||
|
|
||||||
def testQuoting(self):
|
def testQuoting(self):
|
||||||
s = "Quote'this\\! ''ok?''"
|
s = "Quote'this\\! ''ok?''"
|
||||||
self.failUnless(self.execute("SELECT %s AS foo", (s,)) == s,
|
self.failUnless(self.execute("SELECT %s AS foo", (s,)) == s,
|
||||||
|
@ -60,20 +60,20 @@ class TypesBasicTests(TestCase):
|
||||||
def testBinary(self):
|
def testBinary(self):
|
||||||
s = ''.join([chr(x) for x in range(256)])
|
s = ''.join([chr(x) for x in range(256)])
|
||||||
b = psycopg2.Binary(s)
|
b = psycopg2.Binary(s)
|
||||||
r = str(self.execute("SELECT %s::bytea AS foo", (b,)))
|
r = str(self.execute("SELECT %s::bytea AS foo", (b,)))
|
||||||
self.failUnless(r == s, "wrong binary quoting")
|
self.failUnless(r == s, "wrong binary quoting")
|
||||||
# test to make sure an empty Binary is converted to an empty string
|
# test to make sure an empty Binary is converted to an empty string
|
||||||
b = psycopg2.Binary('')
|
b = psycopg2.Binary('')
|
||||||
self.assertEqual(str(b), "''")
|
self.assertEqual(str(b), "''")
|
||||||
|
|
||||||
def testArray(self):
|
def testArray(self):
|
||||||
s = self.execute("SELECT %s AS foo", ([[1,2],[3,4]],))
|
s = self.execute("SELECT %s AS foo", ([[1,2],[3,4]],))
|
||||||
self.failUnless(s == [[1,2],[3,4]], "wrong array quoting " + str(s))
|
self.failUnless(s == [[1,2],[3,4]], "wrong array quoting " + str(s))
|
||||||
s = self.execute("SELECT %s AS foo", (['one', 'two', 'three'],))
|
s = self.execute("SELECT %s AS foo", (['one', 'two', 'three'],))
|
||||||
self.failUnless(s == ['one', 'two', 'three'],
|
self.failUnless(s == ['one', 'two', 'three'],
|
||||||
"wrong array quoting " + str(s))
|
"wrong array quoting " + str(s))
|
||||||
|
|
||||||
|
|
||||||
class TypesBasicSuite(TestSuite):
|
class TypesBasicSuite(TestSuite):
|
||||||
"""Build a suite of all tests."""
|
"""Build a suite of all tests."""
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user