Пример #1
0
 def test_join_on_condition_and_condition(self):
     m = Table('foo').Join('bar').\
         On().Field('foo.id').Op('=').Field('bar.foo_id').\
         And().Field('foo.val').Op('<>').Field('bar.thing')
     self.assertEqual(
         m.render(), 'foo.join(bar, and_(foo.c.id == bar.c.foo_id, '
         'foo.c.val != bar.c.thing))')
Пример #2
0
 def test_join_on_condition_join_table(self):
     m = Table('foo').Join('bar').\
         On().Field('foo.id').Op('=').Field('bar.foo_id').\
         Join('wumbo').On().Field('foo.id').Op('=').Field('wumbo.foo_id')
     self.assertEqual(
         m.render(), 'foo.join(bar, foo.c.id == bar.c.foo_id)'
         '.join(wumbo, foo.c.id == wumbo.c.foo_id)'
     )
Пример #3
0
 def test_join_on_condition_and_condition(self):
     m = Table('foo').Join('bar').\
         On().Field('foo.id').Op('=').Field('bar.foo_id').\
         And().Field('foo.val').Op('<>').Field('bar.thing')
     self.assertEqual(
         m.render(), 'foo.join(bar, and_(foo.c.id == bar.c.foo_id, '
         'foo.c.val != bar.c.thing))'
     )
Пример #4
0
 def test_join_on_condition_and_condition(self):
     m = (
         Table("foo")
         .Join("bar")
         .On()
         .Field("foo.id")
         .Op("=")
         .Field("bar.foo_id")
         .And()
         .Field("foo.val")
         .Op("<>")
         .Field("bar.thing")
     )
     self.assertEqual(
         m.render(),
         "foo.join(bar, and_(foo.c.id == bar.c.foo_id, "
         "foo.c.val != bar.c.thing))",
     )
Пример #5
0
 def test_join_on_condition_join_table(self):
     m = (
         Table("foo")
         .Join("bar")
         .On()
         .Field("foo.id")
         .Op("=")
         .Field("bar.foo_id")
         .Join("wumbo")
         .On()
         .Field("foo.id")
         .Op("=")
         .Field("wumbo.foo_id")
     )
     self.assertEqual(
         m.render(),
         "foo.join(bar, foo.c.id == bar.c.foo_id)"
         ".join(wumbo, foo.c.id == wumbo.c.foo_id)",
     )
Пример #6
0
 def test_join_on_condition(self):
     m = Table("foo").Join("bar").On().Field("foo.id").Op("=").Field("bar.foo_id")
     self.assertEqual(m.render(), "foo.join(bar, foo.c.id == bar.c.foo_id)")
Пример #7
0
    def test_joined_table(self):
        m = Table("A").Join("B")
        self.assertEqual(m.render(), "A.join(B)")

        m = Table("A").Join("B").Join("C").Join("D")
        self.assertEqual(m.render(), "A.join(B).join(C).join(D)")
Пример #8
0
    def test_joined_table(self):
        m = Table('A').Join('B')
        self.assertEqual(m.render(), 'A.join(B)')

        m = Table('A').Join('B').Join('C').Join('D')
        self.assertEqual(m.render(), 'A.join(B).join(C).join(D)')
Пример #9
0
    def test_joined_table(self):
        m = Table('A').Join('B')
        self.assertEqual(m.render(), 'A.join(B)')

        m = Table('A').Join('B').Join('C').Join('D')
        self.assertEqual(m.render(), 'A.join(B).join(C).join(D)')