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

« back to all changes in this revision

Viewing changes to test/sql/test_case_statement.py

  • Committer: Package Import Robot
  • Author(s): Piotr Ożarowski, Jakub Wilk, Piotr Ożarowski
  • Date: 2013-07-06 20:53:52 UTC
  • mfrom: (1.4.23) (16.1.17 experimental)
  • Revision ID: package-import@ubuntu.com-20130706205352-ryppl1eto3illd79
Tags: 0.8.2-1
[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

[ Piotr Ożarowski ]
* New upstream release
* Upload to unstable
* Build depend on python3-all instead of -dev, extensions are not built for
  Python 3.X 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
from test.lib.testing import assert_raises, assert_raises_message, eq_
 
1
from sqlalchemy.testing import assert_raises, assert_raises_message, eq_
2
2
import sys
3
3
from sqlalchemy import *
4
 
from test.lib import *
 
4
from sqlalchemy.testing import fixtures, AssertsCompiledSQL
 
5
from sqlalchemy import testing
5
6
from sqlalchemy import util, exc
6
7
from sqlalchemy.sql import table, column
7
8
 
98
99
 
99
100
        assert_raises(exc.ArgumentError, case, [("x", "y")])
100
101
 
101
 
        self.assert_compile(case([("x", "y")], value=t.c.col1), "CASE test.col1 WHEN :param_1 THEN :param_2 END")
102
 
        self.assert_compile(case([(t.c.col1==7, "y")], else_="z"), "CASE WHEN (test.col1 = :col1_1) THEN :param_1 ELSE :param_2 END")
 
102
        self.assert_compile(case([("x", "y")], value=t.c.col1),
 
103
                "CASE test.col1 WHEN :param_1 THEN :param_2 END")
 
104
        self.assert_compile(case([(t.c.col1 == 7, "y")], else_="z"),
 
105
                "CASE WHEN (test.col1 = :col1_1) THEN :param_1 ELSE :param_2 END")
103
106
 
104
107
    def test_text_doesnt_explode(self):
105
108
 
113
116
                  ))]).order_by(info_table.c.info),
114
117
 
115
118
        ]:
116
 
            eq_(s.execute().fetchall(), [
117
 
                (u'no', ), (u'no', ), (u'no', ), (u'yes', ),
118
 
                (u'no', ), (u'no', ),
119
 
                ])
 
119
            if testing.against("firebird"):
 
120
                eq_(s.execute().fetchall(), [
 
121
                    ('no ', ), ('no ', ), ('no ', ), ('yes', ),
 
122
                    ('no ', ), ('no ', ),
 
123
                    ])
 
124
            else:
 
125
                eq_(s.execute().fetchall(), [
 
126
                    ('no', ), ('no', ), ('no', ), ('yes', ),
 
127
                    ('no', ), ('no', ),
 
128
                    ])
120
129
 
121
130
 
122
131