summaryrefslogtreecommitdiff
path: root/test/sql/test_selectable.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-02-06 12:20:15 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2012-02-06 12:20:15 -0500
commit73f734bf80166c7dfce4892941752d7569a17524 (patch)
tree337f48354f72d2c1ef75f0d9724a395b71e7b50c /test/sql/test_selectable.py
parent2dbeeff50b7ccc6f47b2816a59f99f051fdabc8c (diff)
downloadsqlalchemy-73f734bf80166c7dfce4892941752d7569a17524.tar.gz
initial annotations approach to join conditions. all tests pass, plus additional tests in #1401 pass.
would now like to reorganize RelationshipProperty more around the annotations concept.
Diffstat (limited to 'test/sql/test_selectable.py')
-rw-r--r--test/sql/test_selectable.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py
index 8f599f1d6..6d85f7c4f 100644
--- a/test/sql/test_selectable.py
+++ b/test/sql/test_selectable.py
@@ -1023,6 +1023,25 @@ class AnnotationsTest(fixtures.TestBase):
annot = obj._annotate({})
eq_(set([obj]), set([annot]))
+ def test_compare(self):
+ t = table('t', column('x'), column('y'))
+ x_a = t.c.x._annotate({})
+ assert t.c.x.compare(x_a)
+ assert x_a.compare(t.c.x)
+ assert not x_a.compare(t.c.y)
+ assert not t.c.y.compare(x_a)
+ assert (t.c.x == 5).compare(x_a == 5)
+ assert not (t.c.y == 5).compare(x_a == 5)
+
+ s = select([t])
+ x_p = s.c.x
+ assert not x_a.compare(x_p)
+ assert not t.c.x.compare(x_p)
+ x_p_a = x_p._annotate({})
+ assert x_p_a.compare(x_p)
+ assert x_p.compare(x_p_a)
+ assert not x_p_a.compare(x_a)
+
def test_custom_constructions(self):
from sqlalchemy.schema import Column
class MyColumn(Column):