~ubuntu-branches/debian/jessie/sqlalchemy/jessie

« back to all changes in this revision

Viewing changes to test/sql/test_constraints.py

  • Committer: Package Import Robot
  • Author(s): Piotr Ożarowski
  • Date: 2013-10-28 22:29:40 UTC
  • mfrom: (1.4.24)
  • Revision ID: package-import@ubuntu.com-20131028222940-wvyqffl4g617caun
Tags: 0.8.3-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
726
726
            "ALTER TABLE tbl ADD PRIMARY KEY (a)"
727
727
        )
728
728
 
 
729
    def test_render_check_constraint_sql_literal(self):
 
730
        t, t2 = self._constraint_create_fixture()
 
731
 
 
732
        constraint = CheckConstraint(t.c.a > 5)
 
733
 
 
734
        self.assert_compile(
 
735
            schema.AddConstraint(constraint),
 
736
            "ALTER TABLE tbl ADD CHECK (a > 5)"
 
737
        )
 
738
 
 
739
    def test_render_index_sql_literal(self):
 
740
        t, t2 = self._constraint_create_fixture()
 
741
 
 
742
        constraint = Index('name', t.c.a + 5)
 
743
 
 
744
        self.assert_compile(
 
745
            schema.CreateIndex(constraint),
 
746
            "CREATE INDEX name ON tbl (a + 5)"
 
747
        )
 
748
 
 
749
 
729
750
class ConstraintAPITest(fixtures.TestBase):
730
751
    def test_double_fk_usage_raises(self):
731
752
        f = ForeignKey('b.id')