diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-05-09 16:34:10 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-05-09 16:34:10 +0000 |
| commit | 4a6afd469fad170868554bf28578849bf3dfd5dd (patch) | |
| tree | b396edc33d567ae19dd244e87137296450467725 /test/dialect | |
| parent | 46b7c9dc57a38d5b9e44a4723dad2ad8ec57baca (diff) | |
| download | sqlalchemy-4a6afd469fad170868554bf28578849bf3dfd5dd.tar.gz | |
r4695 merged to trunk; trunk now becomes 0.5.
0.4 development continues at /sqlalchemy/branches/rel_0_4
Diffstat (limited to 'test/dialect')
| -rw-r--r-- | test/dialect/firebird.py | 2 | ||||
| -rw-r--r-- | test/dialect/maxdb.py | 6 | ||||
| -rwxr-xr-x | test/dialect/mssql.py | 4 | ||||
| -rw-r--r-- | test/dialect/mysql.py | 6 | ||||
| -rw-r--r-- | test/dialect/oracle.py | 6 | ||||
| -rw-r--r-- | test/dialect/postgres.py | 12 | ||||
| -rw-r--r-- | test/dialect/sqlite.py | 14 |
7 files changed, 25 insertions, 25 deletions
diff --git a/test/dialect/firebird.py b/test/dialect/firebird.py index f929443fd..da6cc6970 100644 --- a/test/dialect/firebird.py +++ b/test/dialect/firebird.py @@ -1,7 +1,7 @@ import testenv; testenv.configure_for_tests() from sqlalchemy import * from sqlalchemy.databases import firebird -from sqlalchemy.exceptions import ProgrammingError +from sqlalchemy.exc import ProgrammingError from sqlalchemy.sql import table, column from testlib import * diff --git a/test/dialect/maxdb.py b/test/dialect/maxdb.py index 0a35f5470..f0bcd00e1 100644 --- a/test/dialect/maxdb.py +++ b/test/dialect/maxdb.py @@ -3,7 +3,7 @@ import testenv; testenv.configure_for_tests() import StringIO, sys from sqlalchemy import * -from sqlalchemy import exceptions, sql +from sqlalchemy import exc, sql from sqlalchemy.util import Decimal from sqlalchemy.databases import maxdb from testlib import * @@ -53,7 +53,7 @@ class ReflectionTest(TestBase, AssertsExecutionResults): finally: try: testing.db.execute("DROP TABLE dectest") - except exceptions.DatabaseError: + except exc.DatabaseError: pass def test_decimal_fixed_serial(self): @@ -165,7 +165,7 @@ class ReflectionTest(TestBase, AssertsExecutionResults): finally: try: testing.db.execute("DROP TABLE assorted") - except exceptions.DatabaseError: + except exc.DatabaseError: pass class DBAPITest(TestBase, AssertsExecutionResults): diff --git a/test/dialect/mssql.py b/test/dialect/mssql.py index b5d7f1641..c3ce338df 100755 --- a/test/dialect/mssql.py +++ b/test/dialect/mssql.py @@ -2,7 +2,7 @@ import testenv; testenv.configure_for_tests() import re from sqlalchemy import * from sqlalchemy.orm import * -from sqlalchemy import exceptions +from sqlalchemy import exc from sqlalchemy.sql import table, column from sqlalchemy.databases import mssql from testlib import * @@ -210,7 +210,7 @@ class QueryTest(TestBase): r = users.select(limit=3, offset=2, order_by=[users.c.user_id]).execute().fetchall() assert False # InvalidRequestError should have been raised - except exceptions.InvalidRequestError: + except exc.InvalidRequestError: pass finally: metadata.drop_all() diff --git a/test/dialect/mysql.py b/test/dialect/mysql.py index 00478908e..923658b01 100644 --- a/test/dialect/mysql.py +++ b/test/dialect/mysql.py @@ -1,7 +1,7 @@ import testenv; testenv.configure_for_tests() import sets from sqlalchemy import * -from sqlalchemy import sql, exceptions +from sqlalchemy import sql, exc from sqlalchemy.databases import mysql from testlib import * @@ -537,13 +537,13 @@ class TypesTest(TestBase, AssertsExecutionResults): try: enum_table.insert().execute(e1=None, e2=None, e3=None, e4=None) self.assert_(False) - except exceptions.SQLError: + except exc.SQLError: self.assert_(True) try: enum_table.insert().execute(e1='c', e2='c', e3='c', e4='c') self.assert_(False) - except exceptions.InvalidRequestError: + except exc.InvalidRequestError: self.assert_(True) enum_table.insert().execute() diff --git a/test/dialect/oracle.py b/test/dialect/oracle.py index cdd575dd3..24353152d 100644 --- a/test/dialect/oracle.py +++ b/test/dialect/oracle.py @@ -120,10 +120,10 @@ AND mytable.myid = myothertable.otherid(+)", query = table1.outerjoin(table2, table1.c.myid==table2.c.otherid).outerjoin(table3, table3.c.userid==table2.c.otherid) self.assert_compile(query.select(), "SELECT mytable.myid, mytable.name, mytable.description, myothertable.otherid, myothertable.othername, thirdtable.userid, thirdtable.otherstuff FROM mytable LEFT OUTER JOIN myothertable ON mytable.myid = myothertable.otherid LEFT OUTER JOIN thirdtable ON thirdtable.userid = myothertable.otherid") - self.assert_compile(query.select(), "SELECT mytable.myid, mytable.name, mytable.description, myothertable.otherid, myothertable.othername, thirdtable.userid, thirdtable.otherstuff FROM mytable, myothertable, thirdtable WHERE mytable.myid = myothertable.otherid(+) AND thirdtable.userid(+) = myothertable.otherid", dialect=oracle.dialect(use_ansi=False)) + self.assert_compile(query.select(), "SELECT mytable.myid, mytable.name, mytable.description, myothertable.otherid, myothertable.othername, thirdtable.userid, thirdtable.otherstuff FROM mytable, myothertable, thirdtable WHERE thirdtable.userid(+) = myothertable.otherid AND mytable.myid = myothertable.otherid(+)", dialect=oracle.dialect(use_ansi=False)) query = table1.join(table2, table1.c.myid==table2.c.otherid).join(table3, table3.c.userid==table2.c.otherid) - self.assert_compile(query.select(), "SELECT mytable.myid, mytable.name, mytable.description, myothertable.otherid, myothertable.othername, thirdtable.userid, thirdtable.otherstuff FROM mytable, myothertable, thirdtable WHERE mytable.myid = myothertable.otherid AND thirdtable.userid = myothertable.otherid", dialect=oracle.dialect(use_ansi=False)) + self.assert_compile(query.select(), "SELECT mytable.myid, mytable.name, mytable.description, myothertable.otherid, myothertable.othername, thirdtable.userid, thirdtable.otherstuff FROM mytable, myothertable, thirdtable WHERE thirdtable.userid = myothertable.otherid AND mytable.myid = myothertable.otherid", dialect=oracle.dialect(use_ansi=False)) query = table1.join(table2, table1.c.myid==table2.c.otherid).outerjoin(table3, table3.c.userid==table2.c.otherid) self.assert_compile(query.select().order_by(table1.oid_column).limit(10).offset(5), "SELECT myid, name, description, otherid, othername, userid, \ @@ -131,7 +131,7 @@ otherstuff FROM (SELECT mytable.myid AS myid, mytable.name AS name, \ mytable.description AS description, myothertable.otherid AS otherid, \ myothertable.othername AS othername, thirdtable.userid AS userid, \ thirdtable.otherstuff AS otherstuff, ROW_NUMBER() OVER (ORDER BY mytable.rowid) AS ora_rn \ -FROM mytable, myothertable, thirdtable WHERE mytable.myid = myothertable.otherid AND thirdtable.userid(+) = myothertable.otherid) \ +FROM mytable, myothertable, thirdtable WHERE thirdtable.userid(+) = myothertable.otherid AND mytable.myid = myothertable.otherid) \ WHERE ora_rn>5 AND ora_rn<=15", dialect=oracle.dialect(use_ansi=False)) def test_alias_outer_join(self): diff --git a/test/dialect/postgres.py b/test/dialect/postgres.py index 90cc0a477..3e5c200e4 100644 --- a/test/dialect/postgres.py +++ b/test/dialect/postgres.py @@ -2,7 +2,7 @@ import testenv; testenv.configure_for_tests() import datetime from sqlalchemy import * from sqlalchemy.orm import * -from sqlalchemy import exceptions +from sqlalchemy import exc from sqlalchemy.databases import postgres from sqlalchemy.engine.strategies import MockEngineStrategy from testlib import * @@ -332,12 +332,12 @@ class InsertTest(TestBase, AssertsExecutionResults): try: table.insert().execute({'data':'d2'}) assert False - except exceptions.IntegrityError, e: + except exc.IntegrityError, e: assert "violates not-null constraint" in str(e) try: table.insert().execute({'data':'d2'}, {'data':'d3'}) assert False - except exceptions.IntegrityError, e: + except exc.IntegrityError, e: assert "violates not-null constraint" in str(e) table.insert().execute({'id':31, 'data':'d2'}, {'id':32, 'data':'d3'}) @@ -359,12 +359,12 @@ class InsertTest(TestBase, AssertsExecutionResults): try: table.insert().execute({'data':'d2'}) assert False - except exceptions.IntegrityError, e: + except exc.IntegrityError, e: assert "violates not-null constraint" in str(e) try: table.insert().execute({'data':'d2'}, {'data':'d3'}) assert False - except exceptions.IntegrityError, e: + except exc.IntegrityError, e: assert "violates not-null constraint" in str(e) table.insert().execute({'id':31, 'data':'d2'}, {'id':32, 'data':'d3'}) @@ -387,7 +387,7 @@ class DomainReflectionTest(TestBase, AssertsExecutionResults): try: con.execute('CREATE DOMAIN testdomain INTEGER NOT NULL DEFAULT 42') con.execute('CREATE DOMAIN alt_schema.testdomain INTEGER DEFAULT 0') - except exceptions.SQLError, e: + except exc.SQLError, e: if not "already exists" in str(e): raise e con.execute('CREATE TABLE testtable (question integer, answer testdomain)') diff --git a/test/dialect/sqlite.py b/test/dialect/sqlite.py index 585a853d2..4cde5fc33 100644 --- a/test/dialect/sqlite.py +++ b/test/dialect/sqlite.py @@ -3,7 +3,7 @@ import testenv; testenv.configure_for_tests() import datetime from sqlalchemy import * -from sqlalchemy import exceptions +from sqlalchemy import exc from sqlalchemy.databases import sqlite from testlib import * @@ -34,11 +34,11 @@ class TestTypes(TestBase, AssertsExecutionResults): @testing.uses_deprecated('Using String type with no length') def test_type_reflection(self): # (ask_for, roundtripped_as_if_different) - specs = [( String(), sqlite.SLText(), ), + specs = [( String(), sqlite.SLString(), ), ( String(1), sqlite.SLString(1), ), ( String(3), sqlite.SLString(3), ), ( Text(), sqlite.SLText(), ), - ( Unicode(), sqlite.SLText(), ), + ( Unicode(), sqlite.SLString(), ), ( Unicode(1), sqlite.SLString(1), ), ( Unicode(3), sqlite.SLString(3), ), ( UnicodeText(), sqlite.SLText(), ), @@ -94,7 +94,7 @@ class TestTypes(TestBase, AssertsExecutionResults): for table in rt, rv: for i, reflected in enumerate(table.c): print reflected.type, type(expected[i]) - assert isinstance(reflected.type, type(expected[i])) + assert isinstance(reflected.type, type(expected[i])), type(expected[i]) finally: db.execute('DROP VIEW types_v') finally: @@ -212,7 +212,7 @@ class DialectTest(TestBase, AssertsExecutionResults): except: try: cx.execute('DROP TABLE tempy') - except exceptions.DBAPIError: + except exc.DBAPIError: pass raise @@ -247,7 +247,7 @@ class InsertTest(TestBase, AssertsExecutionResults): @testing.exclude('sqlite', '<', (3, 4)) def test_empty_insert_pk2(self): self.assertRaises( - exceptions.DBAPIError, + exc.DBAPIError, self._test_empty_insert, Table('b', MetaData(testing.db), Column('x', Integer, primary_key=True), @@ -256,7 +256,7 @@ class InsertTest(TestBase, AssertsExecutionResults): @testing.exclude('sqlite', '<', (3, 4)) def test_empty_insert_pk3(self): self.assertRaises( - exceptions.DBAPIError, + exc.DBAPIError, self._test_empty_insert, Table('c', MetaData(testing.db), Column('x', Integer, primary_key=True), |
