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,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}
|
||||
|
Reference in New Issue
Block a user