mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
plpython: Remove regression test infrastructure for Python 2.
Since 19252e8ec9
we reject Python 2 during build configuration. Now that the
dust on the buildfarm has settled, remove regression testing infrastructure
dealing with differing output between Python 2 / 3.
Reviewed-By: Peter Eisentraut <peter@eisentraut.org>
Reviewed-By: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/20211031184548.g4sxfe47n2kyi55r@alap3.anarazel.de
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
CREATE EXTENSION hstore_plpython2u CASCADE;
|
||||
CREATE EXTENSION hstore_plpython3u CASCADE;
|
||||
|
||||
|
||||
-- test hstore -> python
|
||||
CREATE FUNCTION test1(val hstore) RETURNS int
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
assert isinstance(val, dict)
|
||||
@ -16,7 +16,7 @@ SELECT test1('aa=>bb, cc=>NULL'::hstore);
|
||||
|
||||
-- the same with the versioned language name
|
||||
CREATE FUNCTION test1n(val hstore) RETURNS int
|
||||
LANGUAGE plpython2u
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
assert isinstance(val, dict)
|
||||
@ -29,7 +29,7 @@ SELECT test1n('aa=>bb, cc=>NULL'::hstore);
|
||||
|
||||
-- test hstore[] -> python
|
||||
CREATE FUNCTION test1arr(val hstore[]) RETURNS int
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
assert(val == [{'aa': 'bb', 'cc': None}, {'dd': 'ee'}])
|
||||
@ -41,7 +41,7 @@ SELECT test1arr(array['aa=>bb, cc=>NULL'::hstore, 'dd=>ee']);
|
||||
|
||||
-- test python -> hstore
|
||||
CREATE FUNCTION test2(a int, b text) RETURNS hstore
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
val = {'a': a, 'b': b, 'c': None}
|
||||
@ -56,7 +56,7 @@ SELECT test2(1, 'boo');
|
||||
|
||||
-- test python -> hstore[]
|
||||
CREATE FUNCTION test2arr() RETURNS hstore[]
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
val = [{'a': 1, 'b': 'boo', 'c': None}, {'d': 2}]
|
||||
@ -70,7 +70,7 @@ SELECT test2arr();
|
||||
CREATE DOMAIN hstore_foo AS hstore CHECK(VALUE ? 'foo');
|
||||
|
||||
CREATE FUNCTION test2dom(fn text) RETURNS hstore_foo
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
return {'a': 1, fn: 'boo', 'c': None}
|
||||
@ -82,7 +82,7 @@ SELECT test2dom('bar'); -- fail
|
||||
|
||||
-- test as part of prepare/execute
|
||||
CREATE FUNCTION test3() RETURNS void
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
rv = plpy.execute("SELECT 'aa=>bb, cc=>NULL'::hstore AS col1")
|
||||
@ -103,7 +103,7 @@ INSERT INTO test1 VALUES (1, 'aa=>bb, cc=>NULL');
|
||||
SELECT * FROM test1;
|
||||
|
||||
CREATE FUNCTION test4() RETURNS trigger
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
assert(TD["new"] == {'a': 1, 'b': {'aa': 'bb', 'cc': None}})
|
||||
|
Reference in New Issue
Block a user