mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-10 19:16:34 +03:00
Releasing 2.0b4.
This commit is contained in:
parent
5f00dc1100
commit
c281a38236
|
@ -17,8 +17,9 @@ from datetime import datetime
|
|||
import psycopg2
|
||||
from psycopg2.extensions import adapt, register_adapter
|
||||
|
||||
try: sorted()
|
||||
except NameError:
|
||||
try:
|
||||
sorted()
|
||||
except:
|
||||
def sorted(seq):
|
||||
seq.sort()
|
||||
return seq
|
||||
|
|
|
@ -19,8 +19,9 @@ DSN = 'dbname=test'
|
|||
|
||||
## don't modify anything below this line (except for experimenting)
|
||||
|
||||
import sys, psycopg2
|
||||
import psycopg.extensions
|
||||
import sys
|
||||
import psycopg2
|
||||
import psycopg2.extensions
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
DSN = sys.argv[1]
|
||||
|
|
|
@ -19,8 +19,9 @@ DSN = 'dbname=test'
|
|||
|
||||
## don't modify anything below tis line (except for experimenting)
|
||||
|
||||
import sys, psycopg2
|
||||
import psycopg.extensions
|
||||
import sys
|
||||
import psycopg2
|
||||
import psycopg2.extensions
|
||||
import whrandom
|
||||
|
||||
# importing psycopg.extras will give us a nice tuple adapter: this is wrong
|
||||
|
|
2
setup.py
2
setup.py
|
@ -55,7 +55,7 @@ from distutils.command.build_ext import build_ext
|
|||
from distutils.sysconfig import get_python_inc
|
||||
from distutils.ccompiler import get_default_compiler
|
||||
|
||||
PSYCOPG_VERSION = '2.0b3'
|
||||
PSYCOPG_VERSION = '2.0b4'
|
||||
version_flags = []
|
||||
|
||||
# to work around older distutil limitations
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# for more details.
|
||||
|
||||
import psycopg
|
||||
import psycopg.extras
|
||||
import psycopg2
|
||||
import psycopg2.extras
|
||||
from unittest import TestCase, TestSuite, main
|
||||
|
||||
|
||||
|
@ -21,12 +21,12 @@ class ExtrasDictCursorTests(TestCase):
|
|||
"""Test if DictCursor extension class works."""
|
||||
|
||||
def setUp(self):
|
||||
self.conn = psycopg.connect("dbname=test")
|
||||
self.conn = psycopg2.connect("dbname=test")
|
||||
curs = self.conn.cursor()
|
||||
curs.execute("CREATE TABLE ExtrasDictCursorTests (foo text)")
|
||||
|
||||
def testDictCursor(self):
|
||||
curs = self.conn.cursor(cursor_factory=psycopg.extras.DictCursor)
|
||||
curs = self.conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
|
||||
curs.execute("INSERT INTO ExtrasDictCursorTests VALUES ('bar')")
|
||||
curs.execute("SELECT * FROM ExtrasDictCursorTests")
|
||||
row = curs.fetchone()
|
||||
|
|
|
@ -12,7 +12,12 @@
|
|||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# for more details.
|
||||
|
||||
import psycopg
|
||||
import sys
|
||||
try:
|
||||
import decimal
|
||||
except:
|
||||
pass
|
||||
import psycopg2
|
||||
from unittest import TestCase, TestSuite, main
|
||||
|
||||
|
||||
|
@ -20,7 +25,7 @@ class TypesBasicTests(TestCase):
|
|||
"""Test presence of mandatory attributes and methods."""
|
||||
|
||||
def setUp(self):
|
||||
self.conn = psycopg.connect("dbname=test")
|
||||
self.conn = psycopg2.connect("dbname=test")
|
||||
|
||||
def execute(self, *args):
|
||||
curs = self.conn.cursor()
|
||||
|
@ -42,13 +47,19 @@ class TypesBasicTests(TestCase):
|
|||
self.failUnless(s == 1971, "wrong integer quoting: " + str(s))
|
||||
s = self.execute("SELECT %s AS foo", (1971L,))
|
||||
self.failUnless(s == 1971L, "wrong integer quoting: " + str(s))
|
||||
s = self.execute("SELECT %s AS foo", (19.10,))
|
||||
self.failUnless(abs(s - 19.10) < 0.001,
|
||||
"wrong float quoting: " + str(s))
|
||||
# Python 2.4 defaults to Decimal?
|
||||
if sys.version_info[0] >= 2 and sys.version_info[1] >= 4:
|
||||
s = self.execute("SELECT %s AS foo", (19.10,))
|
||||
self.failUnless(s - decimal.Decimal("19.10") == 0,
|
||||
"wrong decimal quoting: " + str(s))
|
||||
else:
|
||||
s = self.execute("SELECT %s AS foo", (19.10,))
|
||||
self.failUnless(abs(s - 19.10) < 0.001,
|
||||
"wrong float quoting: " + str(s))
|
||||
|
||||
def testBinary(self):
|
||||
s = ''.join([chr(x) for x in range(256)])
|
||||
b = psycopg.Binary(s)
|
||||
b = psycopg2.Binary(s)
|
||||
r = str(self.execute("SELECT %s::bytea AS foo", (b,)))
|
||||
self.failUnless(r == s, "wrong binary quoting")
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user