]> granicus.if.org Git - postgresql/commitdiff
It may not be obvious to you, but the plpython regression tests
authorBruce Momjian <bruce@momjian.us>
Thu, 27 Mar 2003 16:58:21 +0000 (16:58 +0000)
committerBruce Momjian <bruce@momjian.us>
Thu, 27 Mar 2003 16:58:21 +0000 (16:58 +0000)
include output that vary depending on the python build one is
running. Basically, the order of keys in a dictionary is
non-deterministic, and that part of the test fails for me regularly.

I rewrote the test to work around this problem, and include a patch
file with that change and the change to the expected otuput as well.

Mike Meyer

src/pl/plpython/feature.expected
src/pl/plpython/plpython_function.sql

index b689c1f6154994c1a667aab9a915f221d9205aac..66e4e6709c2509b73f0d4e7f5212849f9d6b14fd 100644 (file)
@@ -54,11 +54,11 @@ select import_test_two(users) from users where fname = 'willem';
 (1 row)
 
 select argument_test_one(users, fname, lname) from users where lname = 'doe' order by 1;
-                                  argument_test_one                                  
--------------------------------------------------------------------------------------
- jane doe => {'fname': 'jane', 'userid': 1, 'lname': 'doe', 'username': 'j_doe'}
- john doe => {'fname': 'john', 'userid': 2, 'lname': 'doe', 'username': 'johnd'}
- willem doe => {'fname': 'willem', 'userid': 3, 'lname': 'doe', 'username': 'w_doe'}
+                           argument_test_one                           
+-----------------------------------------------------------------------
+ jane doe => {fname: jane, lname: doe, userid: 1, username: j_doe}
+ john doe => {fname: john, lname: doe, userid: 2, username: johnd}
+ willem doe => {fname: willem, lname: doe, userid: 3, username: w_doe}
 (3 rows)
 
 select nested_call_one('pass this along');
index 46ab4babd358006c407ad0a40b3d6da64a0dfddb..2769e9de36feb08cfc029213146c2bbcd1cdd142 100644 (file)
@@ -82,7 +82,12 @@ return "sha hash of " + plain + " is " + digest.hexdigest()'
 
 CREATE FUNCTION argument_test_one(users, text, text) RETURNS text
        AS
-'words = args[1] + " " + args[2] + " => " + str(args[0])
+'keys = args[0].keys()
+keys.sort()
+out = []
+for key in keys:
+    out.append("%s: %s" % (key, args[0][key]))
+words = args[1] + " " + args[2] + " => {" + ", ".join(out) + "}"
 return words'
        LANGUAGE 'plpython';