[rqlrewrite] sort possible types when turning is_instance_of into is
Helps get predictable output even with python -R. Related to #4959402.
--- a/rqlrewrite.py Fri Feb 13 11:47:34 2015 +0100
+++ b/rqlrewrite.py Fri Feb 13 11:48:13 2015 +0100
@@ -89,7 +89,7 @@
mytyperel.r_type = 'is'
if len(possibletypes) > 1:
node = n.Function('IN')
- for etype in possibletypes:
+ for etype in sorted(possibletypes):
node.append(n.Constant(etype, 'etype'))
else:
etype = iter(possibletypes).next()
--- a/server/test/unittest_security.py Fri Feb 13 11:47:34 2015 +0100
+++ b/server/test/unittest_security.py Fri Feb 13 11:48:13 2015 +0100
@@ -519,7 +519,7 @@
plan.preprocess(rqlst)
self.assertEqual(
rqlst.as_string(),
- '(Any X WHERE X is IN(SubDivision, Societe)) UNION '
+ '(Any X WHERE X is IN(Societe, SubDivision)) UNION '
'(Any X WHERE X is Division, EXISTS(X owned_by %(B)s))')