diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-08-13 19:45:34 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-08-13 19:45:34 -0400 |
| commit | 7fc08fe89af9760750899346cf81bd74e0d9150f (patch) | |
| tree | d1a9c485c7795bf33bda15900411aefcec91d193 /test/sql | |
| parent | ea85c7053dc9532a95fd487628768fdfc1ca5c30 (diff) | |
| download | sqlalchemy-7fc08fe89af9760750899346cf81bd74e0d9150f.tar.gz | |
- The ``info`` parameter has been added to the constructor for
:class:`.SynonymProperty` and :class:`.ComparableProperty`.
- The ``info`` parameter has been added as a constructor argument
to all schema constructs including :class:`.MetaData`,
:class:`.Index`, :class:`.ForeignKey`, :class:`.ForeignKeyConstraint`,
:class:`.UniqueConstraint`, :class:`.PrimaryKeyConstraint`,
:class:`.CheckConstraint`.
fixes #2963
Diffstat (limited to 'test/sql')
| -rw-r--r-- | test/sql/test_metadata.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/test/sql/test_metadata.py b/test/sql/test_metadata.py index 3a252c646..ff2755ab1 100644 --- a/test/sql/test_metadata.py +++ b/test/sql/test_metadata.py @@ -956,6 +956,71 @@ class ToMetaDataTest(fixtures.TestBase, ComparesTables): 'mytable.myid = othertable.myid') +class InfoTest(fixtures.TestBase): + def test_metadata_info(self): + m1 = MetaData() + eq_(m1.info, {}) + + m1 = MetaData(info={"foo": "bar"}) + eq_(m1.info, {"foo": "bar"}) + + def test_foreignkey_constraint_info(self): + fkc = ForeignKeyConstraint(['a'], ['b'], name='bar') + eq_(fkc.info, {}) + + fkc = ForeignKeyConstraint( + ['a'], ['b'], name='bar', info={"foo": "bar"}) + eq_(fkc.info, {"foo": "bar"}) + + def test_foreignkey_info(self): + fkc = ForeignKey('a') + eq_(fkc.info, {}) + + fkc = ForeignKey('a', info={"foo": "bar"}) + eq_(fkc.info, {"foo": "bar"}) + + def test_primarykey_constraint_info(self): + pkc = PrimaryKeyConstraint('a', name='x') + eq_(pkc.info, {}) + + pkc = PrimaryKeyConstraint('a', name='x', info={'foo': 'bar'}) + eq_(pkc.info, {'foo': 'bar'}) + + def test_unique_constraint_info(self): + uc = UniqueConstraint('a', name='x') + eq_(uc.info, {}) + + uc = UniqueConstraint('a', name='x', info={'foo': 'bar'}) + eq_(uc.info, {'foo': 'bar'}) + + def test_check_constraint_info(self): + cc = CheckConstraint('foo=bar', name='x') + eq_(cc.info, {}) + + cc = CheckConstraint('foo=bar', name='x', info={'foo': 'bar'}) + eq_(cc.info, {'foo': 'bar'}) + + def test_index_info(self): + ix = Index('x', 'a') + eq_(ix.info, {}) + + ix = Index('x', 'a', info={'foo': 'bar'}) + eq_(ix.info, {'foo': 'bar'}) + + def test_column_info(self): + c = Column('x', Integer) + eq_(c.info, {}) + + c = Column('x', Integer, info={'foo': 'bar'}) + eq_(c.info, {'foo': 'bar'}) + + def test_table_info(self): + t = Table('x', MetaData()) + eq_(t.info, {}) + + t = Table('x', MetaData(), info={'foo': 'bar'}) + eq_(t.info, {'foo': 'bar'}) + class TableTest(fixtures.TestBase, AssertsCompiledSQL): @testing.skip_if('mssql', 'different col format') |
