diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-06-30 10:27:52 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-06-30 10:27:52 -0400 |
| commit | fc4f7de0051334987326de1e74cd86d2a08e2e07 (patch) | |
| tree | 391cdf811e054e8e2409ca7f1cab601529c4ef38 /test/engine/test_ddlevents.py | |
| parent | aaa3cebe7224231ca396b1dc812525336dde745e (diff) | |
| download | sqlalchemy-fc4f7de0051334987326de1e74cd86d2a08e2e07.tar.gz | |
- Fixed bug whereby adaptation of old append_ddl_listener()
function was passing unexpected **kw through
to the Table event. Table gets no kws, the MetaData
event in 0.6 would get "tables=somecollection",
this behavior is preserved. [ticket:2206]
Diffstat (limited to 'test/engine/test_ddlevents.py')
| -rw-r--r-- | test/engine/test_ddlevents.py | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/test/engine/test_ddlevents.py b/test/engine/test_ddlevents.py index 536325d88..c1616fcfb 100644 --- a/test/engine/test_ddlevents.py +++ b/test/engine/test_ddlevents.py @@ -261,6 +261,63 @@ class DDLExecutionTest(fixtures.TestBase): assert 'xyzzy' in strings assert 'fnord' in strings + def test_deprecated_append_ddl_listener_table(self): + metadata, users, engine = self.metadata, self.users, self.engine + canary = [] + users.append_ddl_listener('before-create', + lambda e, t, b:canary.append('mxyzptlk') + ) + users.append_ddl_listener('after-create', + lambda e, t, b:canary.append('klptzyxm') + ) + users.append_ddl_listener('before-drop', + lambda e, t, b:canary.append('xyzzy') + ) + users.append_ddl_listener('after-drop', + lambda e, t, b:canary.append('fnord') + ) + + metadata.create_all() + assert 'mxyzptlk' in canary + assert 'klptzyxm' in canary + assert 'xyzzy' not in canary + assert 'fnord' not in canary + del engine.mock[:] + canary[:] = [] + metadata.drop_all() + assert 'mxyzptlk' not in canary + assert 'klptzyxm' not in canary + assert 'xyzzy' in canary + assert 'fnord' in canary + + def test_deprecated_append_ddl_listener_metadata(self): + metadata, users, engine = self.metadata, self.users, self.engine + canary = [] + metadata.append_ddl_listener('before-create', + lambda e, t, b, tables=None:canary.append('mxyzptlk') + ) + metadata.append_ddl_listener('after-create', + lambda e, t, b, tables=None:canary.append('klptzyxm') + ) + metadata.append_ddl_listener('before-drop', + lambda e, t, b, tables=None:canary.append('xyzzy') + ) + metadata.append_ddl_listener('after-drop', + lambda e, t, b, tables=None:canary.append('fnord') + ) + + metadata.create_all() + assert 'mxyzptlk' in canary + assert 'klptzyxm' in canary + assert 'xyzzy' not in canary + assert 'fnord' not in canary + del engine.mock[:] + canary[:] = [] + metadata.drop_all() + assert 'mxyzptlk' not in canary + assert 'klptzyxm' not in canary + assert 'xyzzy' in canary + assert 'fnord' in canary def test_metadata(self): metadata, engine = self.metadata, self.engine |
