summaryrefslogtreecommitdiff
path: root/test/dialect/mssql.py
diff options
context:
space:
mode:
authorJason Kirtland <jek@discorporate.us>2007-08-21 00:43:47 +0000
committerJason Kirtland <jek@discorporate.us>2007-08-21 00:43:47 +0000
commite9015b2d05e7438f7c48e4f59b5a79aec2d85970 (patch)
tree60a84e68d9e73fb3969f984a151a846c9b9cef4a /test/dialect/mssql.py
parent6e3f8e9f49d1984b90bece14e566d2e139f66101 (diff)
downloadsqlalchemy-e9015b2d05e7438f7c48e4f59b5a79aec2d85970.tar.gz
fix line ending svn prop
Diffstat (limited to 'test/dialect/mssql.py')
-rwxr-xr-xtest/dialect/mssql.py94
1 files changed, 47 insertions, 47 deletions
diff --git a/test/dialect/mssql.py b/test/dialect/mssql.py
index 1825141af..781f27029 100755
--- a/test/dialect/mssql.py
+++ b/test/dialect/mssql.py
@@ -1,47 +1,47 @@
-import testbase
-import re
-from sqlalchemy import *
-from sqlalchemy.databases import mssql
-from testlib import *
-
-# TODO: migrate all MS-SQL tests here
-
-class CompileTest(SQLCompileTest):
- __dialect__ = mssql.MSSQLDialect()
-
- def test_insert(self):
- t = table('sometable', column('somecolumn'))
- self.assert_compile(t.insert(), "INSERT INTO sometable (somecolumn) VALUES (:somecolumn)")
-
- def test_update(self):
- t = table('sometable', column('somecolumn'))
- self.assert_compile(t.update(t.c.somecolumn==7), "UPDATE sometable SET somecolumn=:somecolumn WHERE sometable.somecolumn = :sometable_somecolumn", dict(somecolumn=10))
-
- def test_count(self):
- t = table('sometable', column('somecolumn'))
- self.assert_compile(t.count(), "SELECT count(sometable.somecolumn) AS tbl_row_count FROM sometable")
-
- def test_union(self):
- t1 = table('t1',
- column('col1'),
- column('col2'),
- column('col3'),
- column('col4')
- )
- t2 = table('t2',
- column('col1'),
- column('col2'),
- column('col3'),
- column('col4'))
-
- (s1, s2) = (
- select([t1.c.col3.label('col3'), t1.c.col4.label('col4')], t1.c.col2.in_("t1col2r1", "t1col2r2")),
- select([t2.c.col3.label('col3'), t2.c.col4.label('col4')], t2.c.col2.in_("t2col2r2", "t2col2r3"))
- )
- u = union(s1, s2, order_by=['col3', 'col4'])
- self.assert_compile(u, "SELECT t1.col3 AS col3, t1.col4 AS col4 FROM t1 WHERE t1.col2 IN (:t1_col2, :t1_col2_1) UNION SELECT t2.col3 AS col3, t2.col4 AS col4 FROM t2 WHERE t2.col2 IN (:t2_col2, :t2_col2_1) ORDER BY col3, col4")
-
- self.assert_compile(u.alias('bar').select(), "SELECT bar.col3, bar.col4 FROM (SELECT t1.col3 AS col3, t1.col4 AS col4 FROM t1 WHERE t1.col2 IN (:t1_col2, :t1_col2_1) UNION SELECT t2.col3 AS col3, t2.col4 AS col4 FROM t2 WHERE t2.col2 IN (:t2_col2, :t2_col2_1)) AS bar")
-
-if __name__ == "__main__":
- testbase.main()
+import testbase
+import re
+from sqlalchemy import *
+from sqlalchemy.databases import mssql
+from testlib import *
+
+# TODO: migrate all MS-SQL tests here
+
+class CompileTest(SQLCompileTest):
+ __dialect__ = mssql.MSSQLDialect()
+
+ def test_insert(self):
+ t = table('sometable', column('somecolumn'))
+ self.assert_compile(t.insert(), "INSERT INTO sometable (somecolumn) VALUES (:somecolumn)")
+
+ def test_update(self):
+ t = table('sometable', column('somecolumn'))
+ self.assert_compile(t.update(t.c.somecolumn==7), "UPDATE sometable SET somecolumn=:somecolumn WHERE sometable.somecolumn = :sometable_somecolumn", dict(somecolumn=10))
+
+ def test_count(self):
+ t = table('sometable', column('somecolumn'))
+ self.assert_compile(t.count(), "SELECT count(sometable.somecolumn) AS tbl_row_count FROM sometable")
+
+ def test_union(self):
+ t1 = table('t1',
+ column('col1'),
+ column('col2'),
+ column('col3'),
+ column('col4')
+ )
+ t2 = table('t2',
+ column('col1'),
+ column('col2'),
+ column('col3'),
+ column('col4'))
+
+ (s1, s2) = (
+ select([t1.c.col3.label('col3'), t1.c.col4.label('col4')], t1.c.col2.in_("t1col2r1", "t1col2r2")),
+ select([t2.c.col3.label('col3'), t2.c.col4.label('col4')], t2.c.col2.in_("t2col2r2", "t2col2r3"))
+ )
+ u = union(s1, s2, order_by=['col3', 'col4'])
+ self.assert_compile(u, "SELECT t1.col3 AS col3, t1.col4 AS col4 FROM t1 WHERE t1.col2 IN (:t1_col2, :t1_col2_1) UNION SELECT t2.col3 AS col3, t2.col4 AS col4 FROM t2 WHERE t2.col2 IN (:t2_col2, :t2_col2_1) ORDER BY col3, col4")
+
+ self.assert_compile(u.alias('bar').select(), "SELECT bar.col3, bar.col4 FROM (SELECT t1.col3 AS col3, t1.col4 AS col4 FROM t1 WHERE t1.col2 IN (:t1_col2, :t1_col2_1) UNION SELECT t2.col3 AS col3, t2.col4 AS col4 FROM t2 WHERE t2.col2 IN (:t2_col2, :t2_col2_1)) AS bar")
+
+if __name__ == "__main__":
+ testbase.main()