From 73f734bf80166c7dfce4892941752d7569a17524 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 6 Feb 2012 12:20:15 -0500 Subject: 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. --- test/sql/test_selectable.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/sql') 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): -- cgit v1.2.1