1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +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:
Andres Freund
2022-03-07 18:19:56 -08:00
parent 76a29adee7
commit db23464715
60 changed files with 625 additions and 2236 deletions

View File

@ -1,6 +1,4 @@
# Generated subdirectories
/expected/python3/
/log/
/results/
/sql/python3/
/tmp_check/

View File

@ -12,7 +12,6 @@ EXTENSION = jsonb_plpython3u
DATA = jsonb_plpython3u--1.0.sql
REGRESS = jsonb_plpython
REGRESS_PLPYTHON3_MANGLE := $(REGRESS)
ifdef USE_PGXS
PG_CONFIG = pg_config
@ -33,9 +32,3 @@ else
rpathdir = $(python_libdir)
SHLIB_LINK += $(python_libspec) $(python_additional_libs)
endif
ifeq ($(python_majorversion),2)
REGRESS_OPTS += --load-extension=plpythonu --load-extension=jsonb_plpythonu
endif
include $(top_srcdir)/src/pl/plpython/regress-python3-mangle.mk

View File

@ -1,8 +1,8 @@
CREATE EXTENSION jsonb_plpython2u CASCADE;
NOTICE: installing required extension "plpython2u"
CREATE EXTENSION jsonb_plpython3u CASCADE;
NOTICE: installing required extension "plpython3u"
-- test jsonb -> python dict
CREATE FUNCTION test1(val jsonb) RETURNS int
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
assert isinstance(val, dict)
@ -18,7 +18,7 @@ SELECT test1('{"a": 1, "c": "NULL"}'::jsonb);
-- test jsonb -> python dict
-- complex dict with dicts as value
CREATE FUNCTION test1complex(val jsonb) RETURNS int
LANGUAGE plpython2u
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
assert isinstance(val, dict)
@ -34,7 +34,7 @@ SELECT test1complex('{"d": {"d": 1}}'::jsonb);
-- test jsonb[] -> python dict
-- dict with array as value
CREATE FUNCTION test1arr(val jsonb) RETURNS int
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
assert isinstance(val, dict)
@ -50,7 +50,7 @@ SELECT test1arr('{"d":[12, 1]}'::jsonb);
-- test jsonb[] -> python list
-- simple list
CREATE FUNCTION test2arr(val jsonb) RETURNS int
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
assert isinstance(val, list)
@ -66,7 +66,7 @@ SELECT test2arr('[12, 1]'::jsonb);
-- test jsonb[] -> python list
-- array of dicts
CREATE FUNCTION test3arr(val jsonb) RETURNS int
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
assert isinstance(val, list)
@ -81,7 +81,7 @@ SELECT test3arr('[{"a": 1, "b": 2}, {"c": 3,"d": 4}]'::jsonb);
-- test jsonb int -> python int
CREATE FUNCTION test1int(val jsonb) RETURNS int
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
assert(val == 1)
@ -95,7 +95,7 @@ SELECT test1int('1'::jsonb);
-- test jsonb string -> python string
CREATE FUNCTION test1string(val jsonb) RETURNS text
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
assert(val == "a")
@ -109,7 +109,7 @@ SELECT test1string('"a"'::jsonb);
-- test jsonb null -> python None
CREATE FUNCTION test1null(val jsonb) RETURNS int
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
assert(val == None)
@ -123,7 +123,7 @@ SELECT test1null('null'::jsonb);
-- test python -> jsonb
CREATE FUNCTION roundtrip(val jsonb) RETURNS jsonb
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
as $$
return val
@ -238,7 +238,7 @@ SELECT roundtrip('["string", "string2"]'::jsonb);
-- complex numbers -> jsonb
CREATE FUNCTION testComplexNumbers() RETURNS jsonb
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
x = 1 + 2j
@ -250,7 +250,7 @@ CONTEXT: while creating return value
PL/Python function "testcomplexnumbers"
-- range -> jsonb
CREATE FUNCTION testRange() RETURNS jsonb
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
x = range(3)
@ -264,7 +264,7 @@ SELECT testRange();
-- 0xff -> jsonb
CREATE FUNCTION testDecimal() RETURNS jsonb
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
x = 0xff
@ -278,7 +278,7 @@ SELECT testDecimal();
-- tuple -> jsonb
CREATE FUNCTION testTuple() RETURNS jsonb
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
x = (1, 'String', None)
@ -292,7 +292,7 @@ SELECT testTuple();
-- interesting dict -> jsonb
CREATE FUNCTION test_dict1() RETURNS jsonb
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
x = {"a": 1, None: 2, 33: 3}

View File

@ -1,8 +1,8 @@
CREATE EXTENSION jsonb_plpython2u CASCADE;
CREATE EXTENSION jsonb_plpython3u CASCADE;
-- test jsonb -> python dict
CREATE FUNCTION test1(val jsonb) RETURNS int
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
assert isinstance(val, dict)
@ -15,7 +15,7 @@ SELECT test1('{"a": 1, "c": "NULL"}'::jsonb);
-- test jsonb -> python dict
-- complex dict with dicts as value
CREATE FUNCTION test1complex(val jsonb) RETURNS int
LANGUAGE plpython2u
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
assert isinstance(val, dict)
@ -29,7 +29,7 @@ SELECT test1complex('{"d": {"d": 1}}'::jsonb);
-- test jsonb[] -> python dict
-- dict with array as value
CREATE FUNCTION test1arr(val jsonb) RETURNS int
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
assert isinstance(val, dict)
@ -42,7 +42,7 @@ SELECT test1arr('{"d":[12, 1]}'::jsonb);
-- test jsonb[] -> python list
-- simple list
CREATE FUNCTION test2arr(val jsonb) RETURNS int
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
assert isinstance(val, list)
@ -55,7 +55,7 @@ SELECT test2arr('[12, 1]'::jsonb);
-- test jsonb[] -> python list
-- array of dicts
CREATE FUNCTION test3arr(val jsonb) RETURNS int
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
assert isinstance(val, list)
@ -67,7 +67,7 @@ SELECT test3arr('[{"a": 1, "b": 2}, {"c": 3,"d": 4}]'::jsonb);
-- test jsonb int -> python int
CREATE FUNCTION test1int(val jsonb) RETURNS int
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
assert(val == 1)
@ -78,7 +78,7 @@ SELECT test1int('1'::jsonb);
-- test jsonb string -> python string
CREATE FUNCTION test1string(val jsonb) RETURNS text
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
assert(val == "a")
@ -89,7 +89,7 @@ SELECT test1string('"a"'::jsonb);
-- test jsonb null -> python None
CREATE FUNCTION test1null(val jsonb) RETURNS int
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
assert(val == None)
@ -100,7 +100,7 @@ SELECT test1null('null'::jsonb);
-- test python -> jsonb
CREATE FUNCTION roundtrip(val jsonb) RETURNS jsonb
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
as $$
return val
@ -129,7 +129,7 @@ SELECT roundtrip('["string", "string2"]'::jsonb);
-- complex numbers -> jsonb
CREATE FUNCTION testComplexNumbers() RETURNS jsonb
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
x = 1 + 2j
@ -140,7 +140,7 @@ SELECT testComplexNumbers();
-- range -> jsonb
CREATE FUNCTION testRange() RETURNS jsonb
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
x = range(3)
@ -151,7 +151,7 @@ SELECT testRange();
-- 0xff -> jsonb
CREATE FUNCTION testDecimal() RETURNS jsonb
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
x = 0xff
@ -162,7 +162,7 @@ SELECT testDecimal();
-- tuple -> jsonb
CREATE FUNCTION testTuple() RETURNS jsonb
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
x = (1, 'String', None)
@ -173,7 +173,7 @@ SELECT testTuple();
-- interesting dict -> jsonb
CREATE FUNCTION test_dict1() RETURNS jsonb
LANGUAGE plpythonu
LANGUAGE plpython3u
TRANSFORM FOR TYPE jsonb
AS $$
x = {"a": 1, None: 2, 33: 3}