Exemple #1
0
    def test_against_cloned_non_table(self):
        # test that corresponding column digs across
        # clone boundaries with anonymous labeled elements
        col = func.count().label('foo')
        sel = select([col])

        sel2 = visitors.ReplacingCloningVisitor().traverse(sel)
        assert sel2.corresponding_column(col) is sel2.c.foo

        sel3 = visitors.ReplacingCloningVisitor().traverse(sel2)
        assert sel3.corresponding_column(col) is sel3.c.foo
    def test_against_cloned_non_table(self):
        # test that corresponding column digs across
        # clone boundaries with anonymous labeled elements
        col = func.count().label("foo")
        sel = select([col])

        sel2 = visitors.ReplacingCloningVisitor().traverse(sel)
        with testing.expect_deprecated("The SelectBase.c"):
            assert (sel2._implicit_subquery.corresponding_column(col) is
                    sel2.c.foo)

        sel3 = visitors.ReplacingCloningVisitor().traverse(sel2)
        with testing.expect_deprecated("The SelectBase.c"):
            assert (sel3._implicit_subquery.corresponding_column(col) is
                    sel3.c.foo)
Exemple #3
0
 def test_clone_append_column(self):
     sel = select([literal_column('1').label('a')])
     cloned = visitors.ReplacingCloningVisitor().traverse(sel)
     cloned.append_column(literal_column('2').label('b'))
     cloned.append_column(func.foo())
     eq_(cloned.c.keys(), ['a', 'b', 'foo()'])