summaryrefslogtreecommitdiff
path: root/test/sql/test_selectable.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2016-03-21 10:57:40 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2016-03-21 10:57:40 -0400
commit07a4b6cbcda6e6ee6e67893c5a5d2fd01e5f125f (patch)
treea28aac49f1f8fd7aef5ae3ed85a2bd9ce98978d1 /test/sql/test_selectable.py
parent732c613eeb890e7b7cbd04750468dac584151a31 (diff)
downloadsqlalchemy-07a4b6cbcda6e6ee6e67893c5a5d2fd01e5f125f.tar.gz
- Fixed bug where the negation of an EXISTS expression would not
be properly typed as boolean in the result, and also would fail to be anonymously aliased in a SELECT list as is the case with a non-negated EXISTS construct. fixes #3682
Diffstat (limited to 'test/sql/test_selectable.py')
-rw-r--r--test/sql/test_selectable.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py
index 7203cc5a3..94e4ac024 100644
--- a/test/sql/test_selectable.py
+++ b/test/sql/test_selectable.py
@@ -2217,6 +2217,33 @@ class ResultMapTest(fixtures.TestBase):
[Boolean]
)
+ def test_plain_exists(self):
+ expr = exists([1])
+ eq_(type(expr.type), Boolean)
+ eq_(
+ [type(entry[-1]) for
+ entry in select([expr]).compile()._result_columns],
+ [Boolean]
+ )
+
+ def test_plain_exists_negate(self):
+ expr = ~exists([1])
+ eq_(type(expr.type), Boolean)
+ eq_(
+ [type(entry[-1]) for
+ entry in select([expr]).compile()._result_columns],
+ [Boolean]
+ )
+
+ def test_plain_exists_double_negate(self):
+ expr = ~(~exists([1]))
+ eq_(type(expr.type), Boolean)
+ eq_(
+ [type(entry[-1]) for
+ entry in select([expr]).compile()._result_columns],
+ [Boolean]
+ )
+
def test_column_subquery_plain(self):
t = self._fixture()
s1 = select([t.c.x]).where(t.c.x > 5).as_scalar()