summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-02-11 00:28:39 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-02-11 00:28:39 +0000
commitc0b5a0446bf63bdac664421f49742f1156c1911a (patch)
tree9d7822f91325d23e512e77701c9f1280d968ea20 /test/sql
parent90c572b513fb33cb5cd17134efb6018abc76bb1f (diff)
downloadsqlalchemy-c0b5a0446bf63bdac664421f49742f1156c1911a.tar.gz
- updated the naming scheme of the base test classes in test/testlib/testing.py;
tests extend from either TestBase or ORMTest, using additional mixins for special assertion methods as needed
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/case_statement.py2
-rw-r--r--test/sql/constraints.py4
-rw-r--r--test/sql/defaults.py8
-rw-r--r--test/sql/functions.py4
-rw-r--r--test/sql/generative.py8
-rw-r--r--test/sql/labels.py4
-rw-r--r--test/sql/query.py8
-rw-r--r--test/sql/quote.py4
-rw-r--r--test/sql/rowcount.py2
-rw-r--r--test/sql/select.py8
-rwxr-xr-xtest/sql/selectable.py8
-rw-r--r--test/sql/testtypes.py22
-rw-r--r--test/sql/unicode.py4
13 files changed, 43 insertions, 43 deletions
diff --git a/test/sql/case_statement.py b/test/sql/case_statement.py
index 6476537b0..ab68b5210 100644
--- a/test/sql/case_statement.py
+++ b/test/sql/case_statement.py
@@ -4,7 +4,7 @@ from sqlalchemy import *
from testlib import *
-class CaseTest(PersistTest):
+class CaseTest(TestBase):
def setUpAll(self):
metadata = MetaData(testing.db)
diff --git a/test/sql/constraints.py b/test/sql/constraints.py
index 29fffa751..2908e07da 100644
--- a/test/sql/constraints.py
+++ b/test/sql/constraints.py
@@ -4,7 +4,7 @@ from sqlalchemy import exceptions
from testlib import *
from testlib import config, engines
-class ConstraintTest(AssertMixin):
+class ConstraintTest(TestBase, AssertsExecutionResults):
def setUp(self):
global metadata
@@ -202,7 +202,7 @@ class ConstraintTest(AssertMixin):
ss = events.select().execute().fetchall()
-class ConstraintCompilationTest(AssertMixin):
+class ConstraintCompilationTest(TestBase, AssertsExecutionResults):
class accum(object):
def __init__(self):
self.statements = []
diff --git a/test/sql/defaults.py b/test/sql/defaults.py
index 9b8485231..22660c060 100644
--- a/test/sql/defaults.py
+++ b/test/sql/defaults.py
@@ -6,7 +6,7 @@ from sqlalchemy.orm import mapper, create_session
from testlib import *
-class DefaultTest(PersistTest):
+class DefaultTest(TestBase):
def setUpAll(self):
global t, f, f2, ts, currenttime, metadata, default_generator
@@ -267,7 +267,7 @@ class DefaultTest(PersistTest):
finally:
testing.db.execute("drop table speedy_users", None)
-class PKDefaultTest(PersistTest):
+class PKDefaultTest(TestBase):
def setUpAll(self):
global metadata, t1, t2
@@ -296,7 +296,7 @@ class PKDefaultTest(PersistTest):
assert r.last_inserted_ids() == [2]
-class AutoIncrementTest(PersistTest):
+class AutoIncrementTest(TestBase):
def setUp(self):
global aitable, aimeta
@@ -406,7 +406,7 @@ class AutoIncrementTest(PersistTest):
metadata.drop_all()
-class SequenceTest(PersistTest):
+class SequenceTest(TestBase):
__unsupported_on__ = ('sqlite', 'mysql', 'mssql', 'firebird',
'sybase', 'access')
diff --git a/test/sql/functions.py b/test/sql/functions.py
index fe4bbd7ac..f6b1e67f1 100644
--- a/test/sql/functions.py
+++ b/test/sql/functions.py
@@ -21,7 +21,7 @@ if testing.db.name not in databases.__all__:
dialects.append(testing.db.dialect)
-class CompileTest(SQLCompileTest):
+class CompileTest(TestBase, AssertsCompiledSQL):
def test_compile(self):
for dialect in dialects:
bindtemplate = BIND_TEMPLATES[dialect.paramstyle]
@@ -139,7 +139,7 @@ class CompileTest(SQLCompileTest):
, checkparams={'y_1': 45, 'x_1': 17, 'y_2': 12, 'x_2': 5})
-class ExecuteTest(PersistTest):
+class ExecuteTest(TestBase):
def test_standalone_execute(self):
x = testing.db.func.current_date().execute().scalar()
diff --git a/test/sql/generative.py b/test/sql/generative.py
index 26d78c6f0..831c2e287 100644
--- a/test/sql/generative.py
+++ b/test/sql/generative.py
@@ -8,7 +8,7 @@ from sqlalchemy import util
from sqlalchemy.sql import util as sql_util
-class TraversalTest(AssertMixin):
+class TraversalTest(TestBase, AssertsExecutionResults):
"""test ClauseVisitor's traversal, particularly its ability to copy and modify
a ClauseElement in place."""
@@ -138,7 +138,7 @@ class TraversalTest(AssertMixin):
assert struct3 == s3
-class ClauseTest(SQLCompileTest):
+class ClauseTest(TestBase, AssertsCompiledSQL):
"""test copy-in-place behavior of various ClauseElements."""
def setUpAll(self):
@@ -270,7 +270,7 @@ class ClauseTest(SQLCompileTest):
self.assert_compile(Vis().traverse(s, clone=True), "SELECT * FROM table1 WHERE table1.col1 = table2.col1 AND table1.col2 = :table1_col2_1")
-class ClauseAdapterTest(SQLCompileTest):
+class ClauseAdapterTest(TestBase, AssertsCompiledSQL):
def setUpAll(self):
global t1, t2
t1 = table("table1",
@@ -410,7 +410,7 @@ class ClauseAdapterTest(SQLCompileTest):
"LEFT OUTER JOIN table1 AS bar ON anon_1.col1 = bar.col1")
-class SelectTest(SQLCompileTest):
+class SelectTest(TestBase, AssertsCompiledSQL):
"""tests the generative capability of Select"""
def setUpAll(self):
diff --git a/test/sql/labels.py b/test/sql/labels.py
index 8164d7f77..a46d0a650 100644
--- a/test/sql/labels.py
+++ b/test/sql/labels.py
@@ -8,7 +8,7 @@ from sqlalchemy.engine import default
IDENT_LENGTH = 29
-class LabelTypeTest(PersistTest):
+class LabelTypeTest(TestBase):
def test_type(self):
m = MetaData()
t = Table('sometable', m,
@@ -17,7 +17,7 @@ class LabelTypeTest(PersistTest):
assert isinstance(t.c.col1.label('hi').type, Integer)
assert isinstance(select([t.c.col2]).as_scalar().label('lala').type, Float)
-class LongLabelsTest(SQLCompileTest):
+class LongLabelsTest(TestBase, AssertsCompiledSQL):
def setUpAll(self):
global metadata, table1, maxlen
metadata = MetaData(testing.db)
diff --git a/test/sql/query.py b/test/sql/query.py
index 19d11a2f1..533f40fb5 100644
--- a/test/sql/query.py
+++ b/test/sql/query.py
@@ -6,7 +6,7 @@ from sqlalchemy.engine import default
from testlib import *
-class QueryTest(PersistTest):
+class QueryTest(TestBase):
def setUpAll(self):
global users, addresses, metadata
@@ -557,7 +557,7 @@ class QueryTest(PersistTest):
assert len(r) == 1
-class CompoundTest(PersistTest):
+class CompoundTest(TestBase):
"""test compound statements like UNION, INTERSECT, particularly their ability to nest on
different databases."""
def setUpAll(self):
@@ -755,7 +755,7 @@ class CompoundTest(PersistTest):
self.assertEquals(found, wanted)
-class JoinTest(PersistTest):
+class JoinTest(TestBase):
"""Tests join execution.
The compiled SQL emitted by the dialect might be ANSI joins or
@@ -1025,7 +1025,7 @@ class JoinTest(PersistTest):
self.assertRows(expr, [(10, 20, 30)])
-class OperatorTest(PersistTest):
+class OperatorTest(TestBase):
def setUpAll(self):
global metadata, flds
metadata = MetaData(testing.db)
diff --git a/test/sql/quote.py b/test/sql/quote.py
index ee7164836..825e836ff 100644
--- a/test/sql/quote.py
+++ b/test/sql/quote.py
@@ -4,7 +4,7 @@ from sqlalchemy import sql
from sqlalchemy.sql import compiler
from testlib import *
-class QuoteTest(PersistTest):
+class QuoteTest(TestBase):
def setUpAll(self):
# TODO: figure out which databases/which identifiers allow special characters to be used,
# such as: spaces, quote characters, punctuation characters, set up tests for those as
@@ -98,7 +98,7 @@ class QuoteTest(PersistTest):
assert str(x) == '''SELECT "SomeLabel" \nFROM (SELECT 'FooCol' AS "SomeLabel" \nFROM "ImATable")'''
-class PreparerTest(PersistTest):
+class PreparerTest(TestBase):
"""Test the db-agnostic quoting services of IdentifierPreparer."""
def test_unformat(self):
diff --git a/test/sql/rowcount.py b/test/sql/rowcount.py
index dc90c1945..3c9caad75 100644
--- a/test/sql/rowcount.py
+++ b/test/sql/rowcount.py
@@ -3,7 +3,7 @@ from sqlalchemy import *
from testlib import *
-class FoundRowsTest(AssertMixin):
+class FoundRowsTest(TestBase, AssertsExecutionResults):
"""tests rowcount functionality"""
def setUpAll(self):
metadata = MetaData(testing.db)
diff --git a/test/sql/select.py b/test/sql/select.py
index 54b1e87a2..39906dcdb 100644
--- a/test/sql/select.py
+++ b/test/sql/select.py
@@ -48,7 +48,7 @@ addresses = table('addresses',
column('zip')
)
-class SelectTest(SQLCompileTest):
+class SelectTest(TestBase, AssertsCompiledSQL):
def test_attribute_sanity(self):
assert hasattr(table1, 'c')
@@ -1198,7 +1198,7 @@ UNION SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE
else:
self.assert_compile(s1, "SELECT %s FROM (SELECT %s FROM mytable)" % (expr,expr))
-class CRUDTest(SQLCompileTest):
+class CRUDTest(TestBase, AssertsCompiledSQL):
def test_insert(self):
# generic insert, will create bind params for all columns
self.assert_compile(insert(table1), "INSERT INTO mytable (myid, name, description) VALUES (:myid, :name, :description)")
@@ -1304,7 +1304,7 @@ class CRUDTest(SQLCompileTest):
u = table1.delete(table1.c.name==s)
self.assert_compile(u, "DELETE FROM mytable WHERE mytable.name = (SELECT myothertable.othername FROM myothertable WHERE myothertable.otherid = mytable.myid)")
-class InlineDefaultTest(SQLCompileTest):
+class InlineDefaultTest(TestBase, AssertsCompiledSQL):
def test_insert(self):
m = MetaData()
foo = Table('foo', m,
@@ -1330,7 +1330,7 @@ class InlineDefaultTest(SQLCompileTest):
self.assert_compile(t.update(inline=True, values={'col3':'foo'}), "UPDATE test SET col1=foo(:foo_1), col2=(SELECT coalesce(max(foo.id)) AS coalesce_1 FROM foo), col3=:col3")
-class SchemaTest(SQLCompileTest):
+class SchemaTest(TestBase, AssertsCompiledSQL):
@testing.fails_on('mssql')
def test_select(self):
# these tests will fail with the MS-SQL compiler since it will alias schema-qualified tables
diff --git a/test/sql/selectable.py b/test/sql/selectable.py
index fe2f41b2b..c93c62825 100755
--- a/test/sql/selectable.py
+++ b/test/sql/selectable.py
@@ -23,7 +23,7 @@ table2 = Table('table2', metadata,
Column('coly', Integer),
)
-class SelectableTest(AssertMixin):
+class SelectableTest(TestBase, AssertsExecutionResults):
def testdistance(self):
# same column three times
s = select([table.c.col1.label('c2'), table.c.col1, table.c.col1.label('c1')])
@@ -212,7 +212,7 @@ class SelectableTest(AssertMixin):
assert u.corresponding_column(s.oid_column) is u.oid_column
assert u.corresponding_column(s2.oid_column) is u.oid_column
-class PrimaryKeyTest(AssertMixin):
+class PrimaryKeyTest(TestBase, AssertsExecutionResults):
def test_join_pk_collapse_implicit(self):
"""test that redundant columns in a join get 'collapsed' into a minimal primary key,
which is the root column along a chain of foreign key relationships."""
@@ -297,7 +297,7 @@ class PrimaryKeyTest(AssertMixin):
)
-class ReduceTest(AssertMixin):
+class ReduceTest(TestBase, AssertsExecutionResults):
def test_reduce(self):
meta = MetaData()
t1 = Table('t1', meta,
@@ -411,7 +411,7 @@ class ReduceTest(AssertMixin):
)
-class DerivedTest(AssertMixin):
+class DerivedTest(TestBase, AssertsExecutionResults):
def test_table(self):
meta = MetaData()
t1 = Table('t1', meta, Column('c1', Integer, primary_key=True), Column('c2', String(30)))
diff --git a/test/sql/testtypes.py b/test/sql/testtypes.py
index b8de2a302..0c10247e5 100644
--- a/test/sql/testtypes.py
+++ b/test/sql/testtypes.py
@@ -9,7 +9,7 @@ from testlib import *
-class AdaptTest(PersistTest):
+class AdaptTest(TestBase):
def testadapt(self):
e1 = url.URL('postgres').get_dialect()()
e2 = url.URL('mysql').get_dialect()()
@@ -106,7 +106,7 @@ class AdaptTest(PersistTest):
-class UserDefinedTest(PersistTest):
+class UserDefinedTest(TestBase):
"""tests user-defined types."""
def testbasic(self):
@@ -266,7 +266,7 @@ class UserDefinedTest(PersistTest):
def tearDownAll(self):
metadata.drop_all()
-class ColumnsTest(AssertMixin):
+class ColumnsTest(TestBase, AssertsExecutionResults):
def testcolumns(self):
expectedResults = { 'int_column': 'int_column INTEGER',
@@ -299,7 +299,7 @@ class ColumnsTest(AssertMixin):
db.dialect.schemagenerator(db.dialect, db, None, None).\
get_column_specification(aCol))
-class UnicodeTest(AssertMixin):
+class UnicodeTest(TestBase, AssertsExecutionResults):
"""tests the Unicode type. also tests the TypeDecorator with instances in the types package."""
def setUpAll(self):
global unicode_table
@@ -400,7 +400,7 @@ class UnicodeTest(AssertMixin):
teststr = u'aaa\x1234'
self.assert_(testing.db.func.length(teststr).scalar() == len(teststr))
-class BinaryTest(AssertMixin):
+class BinaryTest(TestBase, AssertsExecutionResults):
def setUpAll(self):
global binary_table, MyPickleType
@@ -467,7 +467,7 @@ class BinaryTest(AssertMixin):
# put a number less than the typical MySQL default BLOB size
return file(f).read(len)
-class ExpressionTest(AssertMixin):
+class ExpressionTest(TestBase, AssertsExecutionResults):
def setUpAll(self):
global test_table, meta
@@ -537,7 +537,7 @@ class ExpressionTest(AssertMixin):
# processing rules on the column.
assert testing.db.execute(select([expr])).scalar() == -15
-class DateTest(AssertMixin):
+class DateTest(TestBase, AssertsExecutionResults):
def setUpAll(self):
global users_with_date, insert_data
@@ -662,7 +662,7 @@ class DateTest(AssertMixin):
finally:
t.drop(checkfirst=True)
-class StringTest(AssertMixin):
+class StringTest(TestBase, AssertsExecutionResults):
def test_nolen_string_deprecated(self):
metadata = MetaData(testing.db)
foo =Table('foo', metadata,
@@ -698,7 +698,7 @@ def _missing_decimal():
except ImportError:
return True
-class NumericTest(AssertMixin):
+class NumericTest(TestBase, AssertsExecutionResults):
def setUpAll(self):
global numeric_table, metadata
metadata = MetaData(testing.db)
@@ -750,7 +750,7 @@ class NumericTest(AssertMixin):
assert isinstance(row['fcasdec'], util.decimal_type)
-class IntervalTest(AssertMixin):
+class IntervalTest(TestBase, AssertsExecutionResults):
def setUpAll(self):
global interval_table, metadata
metadata = MetaData(testing.db)
@@ -775,7 +775,7 @@ class IntervalTest(AssertMixin):
interval_table.insert().execute(id=1, inverval=None)
assert interval_table.select().execute().fetchone()['interval'] is None
-class BooleanTest(AssertMixin):
+class BooleanTest(TestBase, AssertsExecutionResults):
def setUpAll(self):
global bool_table
metadata = MetaData(testing.db)
diff --git a/test/sql/unicode.py b/test/sql/unicode.py
index 54d453025..9e3ea257e 100644
--- a/test/sql/unicode.py
+++ b/test/sql/unicode.py
@@ -7,7 +7,7 @@ from testlib import *
from testlib.engines import utf8_engine
from sqlalchemy.sql import column
-class UnicodeSchemaTest(PersistTest):
+class UnicodeSchemaTest(TestBase):
@testing.unsupported('maxdb', 'oracle', 'sybase')
def setUpAll(self):
global unicode_bind, metadata, t1, t2, t3
@@ -112,7 +112,7 @@ class UnicodeSchemaTest(PersistTest):
meta.drop_all()
metadata.create_all()
-class EscapesDefaultsTest(testing.PersistTest):
+class EscapesDefaultsTest(testing.TestBase):
def test_default_exec(self):
metadata = MetaData(testing.db)
t1 = Table('t1', metadata,