summaryrefslogtreecommitdiff
path: root/test/engine/test_bind.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-08-12 17:50:37 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-08-12 17:50:37 -0400
commitf6198d9abf453182f4b111e0579a7a4ef1614e79 (patch)
treee258eafc9db70c4745d98a56b55b439732aebf91 /test/engine/test_bind.py
parente8c2a2738b6c15cb12e7571b9e12c15cc2f200c9 (diff)
downloadsqlalchemy-f6198d9abf453182f4b111e0579a7a4ef1614e79.tar.gz
- A large refactoring of the ``sqlalchemy.sql`` package has reorganized
the import structure of many core modules. ``sqlalchemy.schema`` and ``sqlalchemy.types`` remain in the top-level package, but are now just lists of names that pull from within ``sqlalchemy.sql``. Their implementations are now broken out among ``sqlalchemy.sql.type_api``, ``sqlalchemy.sql.sqltypes``, ``sqlalchemy.sql.schema`` and ``sqlalchemy.sql.ddl``, the last of which was moved from ``sqlalchemy.engine``. ``sqlalchemy.sql.expression`` is also a namespace now which pulls implementations mostly from ``sqlalchemy.sql.elements``, ``sqlalchemy.sql.selectable``, and ``sqlalchemy.sql.dml``. Most of the "factory" functions used to create SQL expression objects have been moved to classmethods or constructors, which are exposed in ``sqlalchemy.sql.expression`` using a programmatic system. Care has been taken such that all the original import namespaces remain intact and there should be no impact on any existing applications. The rationale here was to break out these very large modules into smaller ones, provide more manageable lists of function names, to greatly reduce "import cycles" and clarify the up-front importing of names, and to remove the need for redundant functions and documentation throughout the expression package.
Diffstat (limited to 'test/engine/test_bind.py')
-rw-r--r--test/engine/test_bind.py42
1 files changed, 15 insertions, 27 deletions
diff --git a/test/engine/test_bind.py b/test/engine/test_bind.py
index 973cf4d84..8f6c547f1 100644
--- a/test/engine/test_bind.py
+++ b/test/engine/test_bind.py
@@ -1,7 +1,7 @@
"""tests the "bind" attribute/argument across schema and SQL,
including the deprecated versions of these arguments"""
-from sqlalchemy.testing import eq_, assert_raises
+from sqlalchemy.testing import assert_raises, assert_raises_message
from sqlalchemy import engine, exc
from sqlalchemy import MetaData, ThreadLocalMetaData
from sqlalchemy import Integer, text
@@ -44,7 +44,7 @@ class BindTest(fixtures.TestBase):
testing.db.connect()
):
for args in [
- ([], {'bind':bind}),
+ ([], {'bind': bind}),
([bind], {})
]:
metadata.create_all(*args[0], **args[1])
@@ -56,18 +56,13 @@ class BindTest(fixtures.TestBase):
def test_create_drop_err_metadata(self):
metadata = MetaData()
- table = Table('test_table', metadata, Column('foo', Integer))
+ Table('test_table', metadata, Column('foo', Integer))
for meth in [metadata.create_all, metadata.drop_all]:
- try:
- meth()
- assert False
- except exc.UnboundExecutionError as e:
- eq_(str(e),
- "The MetaData is not bound to an Engine or "
- "Connection. Execution can not proceed without a "
- "database to execute against. Either execute with "
- "an explicit connection or assign the MetaData's "
- ".bind to enable implicit execution.")
+ assert_raises_message(
+ exc.UnboundExecutionError,
+ "MetaData object is not bound to an Engine or Connection.",
+ meth
+ )
def test_create_drop_err_table(self):
metadata = MetaData()
@@ -79,23 +74,16 @@ class BindTest(fixtures.TestBase):
table.create,
table.drop,
]:
- try:
- meth()
- assert False
- except exc.UnboundExecutionError as e:
- eq_(
- str(e),
- "The Table 'test_table' "
- "is not bound to an Engine or Connection. "
- "Execution can not proceed without a database to execute "
- "against. Either execute with an explicit connection or "
- "assign this Table's .metadata.bind to enable implicit "
- "execution.")
+ assert_raises_message(
+ exc.UnboundExecutionError,
+ "Table object 'test_table' is not bound to an Engine or Connection.",
+ meth
+ )
@testing.uses_deprecated()
def test_create_drop_bound(self):
- for meta in (MetaData,ThreadLocalMetaData):
+ for meta in (MetaData, ThreadLocalMetaData):
for bind in (
testing.db,
testing.db.connect()
@@ -136,7 +124,7 @@ class BindTest(fixtures.TestBase):
try:
for args in (
([bind], {}),
- ([], {'bind':bind}),
+ ([], {'bind': bind}),
):
metadata = MetaData(*args[0], **args[1])
table = Table('test_table', metadata,