~ubuntu-branches/debian/jessie/sqlalchemy/jessie

« back to all changes in this revision

Viewing changes to test/sql/test_metadata.py

  • Committer: Package Import Robot
  • Author(s): Piotr Ożarowski
  • Date: 2013-10-28 22:29:40 UTC
  • mfrom: (1.4.24)
  • Revision ID: package-import@ubuntu.com-20131028222940-wvyqffl4g617caun
Tags: 0.8.3-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
212
212
        assert b.c.a_id.references(a.c.id)
213
213
        eq_(len(b.constraints), 2)
214
214
 
 
215
    def test_fk_erroneous_schema_arg(self):
 
216
        assert_raises_message(
 
217
            exc.SADeprecationWarning,
 
218
            "'schema' argument on ForeignKey has no effect.",
 
219
            ForeignKey, "foo.bar", schema='myschema'
 
220
        )
 
221
 
215
222
    def test_fk_construct(self):
216
223
        c1 = Column('foo', Integer)
217
224
        c2 = Column('bar', Integer)
1302
1309
        assert c.name == 'named'
1303
1310
        assert c.name == c.key
1304
1311
 
 
1312
    def test_unique_index_flags_default_to_none(self):
 
1313
        c = Column(Integer)
 
1314
        eq_(c.unique, None)
 
1315
        eq_(c.index, None)
 
1316
 
 
1317
        c = Column('c', Integer, index=True)
 
1318
        eq_(c.unique, None)
 
1319
        eq_(c.index, True)
 
1320
 
 
1321
        t = Table('t', MetaData(), c)
 
1322
        eq_(list(t.indexes)[0].unique, False)
 
1323
 
 
1324
        c = Column(Integer, unique=True)
 
1325
        eq_(c.unique, True)
 
1326
        eq_(c.index, None)
 
1327
 
 
1328
        c = Column('c', Integer, index=True, unique=True)
 
1329
        eq_(c.unique, True)
 
1330
        eq_(c.index, True)
 
1331
 
 
1332
        t = Table('t', MetaData(), c)
 
1333
        eq_(list(t.indexes)[0].unique, True)
1305
1334
 
1306
1335
    def test_bogus(self):
1307
1336
        assert_raises(exc.ArgumentError, Column, 'foo', name='bar')