]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- aaaaand fix one more glitch I just thought of
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 18 Aug 2012 05:03:31 +0000 (01:03 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 18 Aug 2012 05:03:31 +0000 (01:03 -0400)
lib/sqlalchemy/sql/expression.py
test/sql/test_selectable.py

index e8905ccec52b6d57462cff7c27d804b87604fdde..969a6920b25dec10127d0b0746783a446f0f1ed2 100644 (file)
@@ -1586,6 +1586,7 @@ class ClauseElement(Visitable):
         c = self.__class__.__new__(self.__class__)
         c.__dict__ = self.__dict__.copy()
         c.__dict__.pop('_cloned_set', None)
+        c.__dict__.pop('comparator', None)
 
         # this is a marker that helps to "equate" clauses to each other
         # when a Select returns its list of FROM clauses.  the cloning
index 045f6695c34de137715b7512ab477a6f685e1582..b81bd8e6fea0299e347f7bd59331b04a849fd34a 100644 (file)
@@ -1,7 +1,7 @@
 """Test various algorithmic properties of selectables."""
 
 from test.lib.testing import eq_, assert_raises, \
-    assert_raises_message
+    assert_raises_message, is_
 from sqlalchemy import *
 from test.lib import *
 from sqlalchemy.sql import util as sql_util, visitors
@@ -348,6 +348,14 @@ class SelectableTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiled
         criterion = a.c.table1_col1 == table2.c.col2
         self.assert_(criterion.compare(j.onclause))
 
+    def test_scalar_cloned_comparator(self):
+        sel = select([table1.c.col1]).as_scalar()
+        expr = sel == table1.c.col1
+
+        sel2 = visitors.ReplacingCloningVisitor().traverse(sel)
+
+        expr2 = sel2 == table1.c.col1
+        is_(expr2.left, sel2)
 
     def test_column_labels(self):
         a = select([table1.c.col1.label('acol1'),