sqlalchemy.testing.is_true

Here are the examples of the python api sqlalchemy.testing.is_true taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

5 Examples 7

Example 1

Project: sqlalchemy Source File: test_lazy_relations.py
    def test_use_get_sameorder(self):
        mapper(self.classes.A, self.tables.a)
        m_b = mapper(self.classes.B, self.tables.b_sameorder, properties={
            'a': relationship(self.classes.A)
        })

        configure_mappers()
        is_true(m_b.relationships.a.strategy.use_get)

Example 2

Project: sqlalchemy Source File: test_lazy_relations.py
    def test_use_get_reverseorder(self):
        mapper(self.classes.A, self.tables.a)
        m_b = mapper(self.classes.B, self.tables.b_differentorder, properties={
            'a': relationship(self.classes.A)
        })

        configure_mappers()
        is_true(m_b.relationships.a.strategy.use_get)

Example 3

Project: sqlalchemy Source File: test_utils.py
    def test_compare_clauselist_not_associative(self):

        l1 = ClauseList(
            self.a.c.x, self.a.c.y, self.b.c.y, operator=operators.sub)

        l2 = ClauseList(
            self.b.c.y, self.a.c.x, self.a.c.y, operator=operators.sub)

        is_true(l1.compare(l1))
        is_false(l1.compare(l2))

Example 4

Project: sqlalchemy Source File: test_utils.py
    def test_compare_clauselist_associative(self):

        l1 = and_(
            self.a.c.x == self.b.c.y,
            self.a.c.y == self.b.c.z
        )

        l2 = and_(
            self.a.c.y == self.b.c.z,
            self.a.c.x == self.b.c.y,
        )

        l3 = and_(
            self.a.c.x == self.b.c.z,
            self.a.c.y == self.b.c.y
        )

        is_true(l1.compare(l1))
        is_true(l1.compare(l2))
        is_false(l1.compare(l3))

Example 5

Project: sqlalchemy Source File: test_utils.py
    def test_compare_binds(self):
        b1 = bindparam("foo", type_=Integer())
        b2 = bindparam("foo", type_=Integer())
        b3 = bindparam("bar", type_=Integer())
        b4 = bindparam("foo", type_=String())

        c1 = lambda: 5  # noqa
        c2 = lambda: 6  # noqa

        b5 = bindparam("foo", type_=Integer(), callable_=c1)
        b6 = bindparam("foo", type_=Integer(), callable_=c2)
        b7 = bindparam("foo", type_=Integer(), callable_=c1)

        b8 = bindparam("foo", type_=Integer, value=5)
        b9 = bindparam("foo", type_=Integer, value=6)

        is_false(b1.compare(b5))
        is_true(b5.compare(b7))
        is_false(b5.compare(b6))
        is_true(b1.compare(b2))

        # currently not comparing "key", as we often have to compare
        # anonymous names.  however we should really check for that
        is_true(b1.compare(b3))

        is_false(b1.compare(b4))
        is_false(b1.compare(b8))
        is_false(b8.compare(b9))
        is_true(b8.compare(b8))