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