Commit Graph

42 Commits

Author SHA1 Message Date
Daniele Varrazzo
e0cd6f0f00 Added tests for our own bytea parser
Because the parse function is not supposed to be exposed in Python,
use ctypes to directly inspect the C function.
2011-03-26 12:59:14 +00:00
Daniele Varrazzo
66c543b16c Parse bytea output format ourselves instead of using the libpq
PG 9.0 uses the hex format by default, and clients < 9.0 can't parse that
format, requiring client update and great care in what is linked at runtime,
and generally giving headache to users and transitively us.
2011-03-26 12:59:14 +00:00
Daniele Varrazzo
894d3f653c Raise an exception if the libpq fails to decode bytea in hex format 2011-02-23 14:04:27 +00:00
Daniele Varrazzo
7996333ee7 Added regression test to check {} is also a valid string 2011-02-20 12:28:50 +00:00
Benjamin Poulain
5ee60571a5 Add a type converter to handle untyped empty arrays.
Empty array can be returned untyped by postgres. To handle
this case, a special handler is added for the type UNKNOWNOID.
If the value return by the database is strictly equal to "{}",
the value is converted. Otherwise, the conversion fallback on
the default handler.
2011-02-20 12:28:10 +00:00
Daniele Varrazzo
836f8a1aa1 Make Binary(None) work as expected, adapting to NULL
Issue reported by Stefano Dal Pra.
2011-02-18 14:19:57 +00:00
Daniele Varrazzo
3ae2f221b3 Adapt bytearray and memoryview to bytes if available 2011-02-15 17:30:43 +00:00
Daniele Varrazzo
c96ba553da Cleanup of skipping of testing methods on certain Py/PG versions 2011-02-15 17:11:07 +00:00
Daniele Varrazzo
c1fe0b675a Dropped correct roundtrip of empty array
The feature in itself is not extremely useful and instead PostgreSQL is
not always able to cast away from text[], which is a regression see
(ticket #42).
2011-02-15 10:27:47 +00:00
Daniele Varrazzo
4c336a51bc Added test to check issue #40 2011-02-12 20:19:02 +00:00
Daniele Varrazzo
80bd6e2794 Merge branch 'python2' into python3
Conflicts:
	NEWS-2.3
	psycopg/connection_type.c
	tests/test_connection.py
	tests/types_basic.py
2011-01-03 21:43:02 +01:00
Daniele Varrazzo
131c6a25e9 Unregister test adapters to keep a more precise references count 2011-01-03 21:34:46 +01:00
Daniele Varrazzo
b78ff4a273 Several tests ported to Python 3. 2010-12-31 03:18:27 +01:00
Daniele Varrazzo
60841c6567 Added regression test on bool adaptation. 2010-12-31 03:18:27 +01:00
Daniele Varrazzo
beba064983 Test on basic adapters pass on Python 3. 2010-12-31 03:18:26 +01:00
Daniele Varrazzo
89e4d4c7bb Empty lists correctly roundtrip. 2010-12-31 03:18:26 +01:00
Daniele Varrazzo
ade1b2cc7b Test suite converted into a proper package.
Dropped cyclic import from modules to tests: they were only working
because a second copy of the package was found in the project dir.
Use relative import so that 2to3 can do a good conversion.
2010-12-21 05:02:19 +00:00
Daniele Varrazzo
361786f4a8 More careful connections handling during tests. 2010-11-28 17:29:37 +00:00
Daniele Varrazzo
bb44bcd5b5 Skipped inf test on the platform not supporting it (win32). 2010-11-24 10:50:28 +00:00
Daniele Varrazzo
21dfc2c592 Float test skipped where the server doesn't support inf. 2010-11-19 10:44:39 +00:00
Daniele Varrazzo
19ead4a5cb Test cleanup.
Tests pass or fail gracefully on older PostgreSQL versions.

If unittest2 is available, skip tests instead of printing warnings.
2010-11-19 03:55:37 +00:00
Daniele Varrazzo
11c021cb21 Fixed tests to run on Windows. 2010-11-11 10:39:35 +00:00
Daniele Varrazzo
62d3a1533b Use the adapter of an object superclass if available. 2010-11-08 01:35:06 +00:00
Daniele Varrazzo
c8aef26e15 Adapt buffer objects using an explicit cast on the string literal.
Don't rely on Postgres casting the literal according to the context:
this doesn't work e.g. passing the object as function argument where a
function with the same name but taking a text exists. It doesn't work
either when the object is in an ARRAY construct.

Added test to check the type is respected in a complete Py -> PG -> Py
roundtrip without context.

Bug and solution reported by Peter Eisentraut.
2010-05-15 14:27:23 +01:00
Federico Di Gregorio
192034dc38 Fixed problem with decimal.Decimal conversions 2010-02-21 01:04:00 +01:00
Federico Di Gregorio
611606d532 Changes license to LGPL3 + OpenSSL exception on all source files 2010-02-12 23:34:53 +01:00
Federico Di Gregorio
d40a5321f2 Fixed test broken by float precision fix 2009-11-25 10:38:31 +01:00
Federico Di Gregorio
eb25f9f154 Added adapter to handle float('inf') and float('nan') 2009-01-23 00:09:20 +01:00
Federico Di Gregorio
b92601306e Added suppport for UUID and related test. 2008-09-19 21:25:16 +02:00
James Henstridge
2f3f4c1258 2008-04-21 Jorgen Austvik <Jorgen.Austvik@sun.com>
* tests/*.py: use the DSN constructed in tests/__init__.py.

	* tests/__init__.py: allow setting the host, port and user for the
	DSN used by the tests through the environment.
2008-04-20 23:12:21 +00:00
James Henstridge
bc663111b6 Split the binary tests out a bit. 2008-01-16 18:08:12 +00:00
James Henstridge
86597f6939 * psycopg/adapter_binary.c (binary_quote): apply Brandon Rhodes'
patch from ticket #209 to check return value from
	PyObject_AsCharBuffer().  This fixes the segfault.
	(binary_quote): switch from PyObject_AsCharBuffer() to
	PyObject_AsReadBuffer() to support buffer objects that don't
	implement the bf_getcharbuf protocol.

	* tests/types_basic.py (TypesBasicTests.testBinary): Test round
	tripping of bytea buffers.  Currently segfaults.
2008-01-10 22:19:23 +00:00
Daniele Varrazzo
67afd678b0 Added 'make check' target, running all the available tests.
Most of the updates have been provided by James Henstridge.

Closes ticket #195.
2007-11-11 10:40:12 +00:00
Daniele Varrazzo
a6ea092acc - Tabs fixed. 2007-11-11 03:58:45 +00:00
Federico Di Gregorio
9f9af5f907 Fixed patch from #119. 2006-09-01 12:36:38 +00:00
Federico Di Gregorio
f88b973bd1 Empty binary buffer segfault fix (closes: #119). 2006-09-01 08:23:51 +00:00
Federico Di Gregorio
c281a38236 Releasing 2.0b4. 2005-07-17 04:26:27 +00:00
Federico Di Gregorio
b300cd2550 Fixed .execute() segfault. 2005-06-02 04:30:31 +00:00
Federico Di Gregorio
2804f9a6a9 Regression tests fixes. 2005-05-27 08:43:33 +00:00
Federico Di Gregorio
9316c6af53 Optimizations to type casting (in preparation to array support.) 2005-03-12 06:39:47 +00:00
Federico Di Gregorio
131b8ac1c5 Preparing 1.99.12. 2005-03-03 06:52:28 +00:00
Federico Di Gregorio
6ad60725be Writing tests... 2004-12-20 02:33:12 +00:00