summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-02-05 15:49:02 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2010-02-05 15:49:02 +0000
commita4a38a982aa04f3d08e662c50e55be23cefcc492 (patch)
tree3f665714d23871466fe6c76566fa8dd1ffa808d2 /test/sql
parentdfbb1fc148fa784000dfee43a194d3f8d40a0ae2 (diff)
downloadsqlalchemy-a4a38a982aa04f3d08e662c50e55be23cefcc492.tar.gz
- Added math negation operator support, -x.
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/test_select.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/sql/test_select.py b/test/sql/test_select.py
index 8390c7342..766ce8e9b 100644
--- a/test/sql/test_select.py
+++ b/test/sql/test_select.py
@@ -568,7 +568,20 @@ sq.myothertable_othername AS sq_myothertable_othername FROM (" + sqstring + ") A
self.assert_(compiled == fwd_sql or compiled == rev_sql,
"\n'" + compiled + "'\n does not match\n'" +
fwd_sql + "'\n or\n'" + rev_sql + "'")
-
+
+ for (py_op, op) in (
+ (operator.neg, '-'),
+ (operator.inv, 'NOT '),
+ ):
+ for expr, sql in (
+ (table1.c.myid, "mytable.myid"),
+ (literal("foo"), ":param_1"),
+ ):
+
+ compiled = str(py_op(expr))
+ sql = "%s%s" % (op, sql)
+ eq_(compiled, sql)
+
self.assert_compile(
table1.select((table1.c.myid != 12) & ~(table1.c.name=='john')),
"SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE mytable.myid != :myid_1 AND mytable.name != :name_1"