From e6c2e8cb87846161033e1f215876c4b95f631df0 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Wed, 2 May 2012 21:09:03 +0300
Subject: PL/Python: Improve test coverage

Add test cases for inline handler of plython2u (when using that
language name), and for result object element assignment.  There is
now at least one test case for every top-level functionality, except
plpy.Fatal (annoying to use in regression tests) and result object
slice retrieval and slice assignment (which are somewhat broken).
---
 src/pl/plpython/sql/plpython_spi.sql | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

(limited to 'src/pl/plpython/sql/plpython_spi.sql')

diff --git a/src/pl/plpython/sql/plpython_spi.sql b/src/pl/plpython/sql/plpython_spi.sql
index ce218e93b6..7be2fbff71 100644
--- a/src/pl/plpython/sql/plpython_spi.sql
+++ b/src/pl/plpython/sql/plpython_spi.sql
@@ -1,3 +1,18 @@
+--
+-- result objects
+--
+
+CREATE FUNCTION test_resultobject_access() RETURNS void
+AS $$
+rv = plpy.execute("SELECT fname, lname, username FROM users ORDER BY username")
+plpy.info([row for row in rv])
+rv[1] = dict([(k, v*2) for (k, v) in rv[1].items()])
+plpy.info([row for row in rv])
+$$ LANGUAGE plpythonu;
+
+SELECT test_resultobject_access();
+
+
 --
 -- nested calls
 --
-- 
cgit v1.2.1

