@testing.provide_metadata
def test_reflection_with_unique_constraint(self):
    insp = inspect(testing.db)
    meta = self.metadata
    uc_table = Table('mysql_uc', meta, Column('a', String(10)), UniqueConstraint('a', name='uc_a'))
    uc_table.create()
    indexes = dict(((i['name'], i) for i in insp.get_indexes('mysql_uc')))
    constraints = set((i['name'] for i in insp.get_unique_constraints('mysql_uc')))
    self.assert_(('uc_a' in indexes))
    self.assert_(indexes['uc_a']['unique'])
    self.assert_(('uc_a' in constraints))
    reflected = Table('mysql_uc', MetaData(testing.db), autoload=True)
    indexes = dict(((i.name, i) for i in reflected.indexes))
    constraints = set((uc.name for uc in reflected.constraints))
    self.assert_(('uc_a' in indexes))
    self.assert_(indexes['uc_a'].unique)
    self.assert_(('uc_a' not in constraints))
@testing.provide_metadata
def test_reflection_with_unique_constraint(self):
    insp = inspect(testing.db)
    meta = self.metadata
    uc_table = Table('mysql_uc', meta, Column('a', String(10)), UniqueConstraint('a', name='uc_a'))
    uc_table.create()
    indexes = dict(((i['name'], i) for i in insp.get_indexes('mysql_uc')))
    constraints = set((i['name'] for i in insp.get_unique_constraints('mysql_uc')))
    self.assert_(('uc_a' in indexes))
    self.assert_(indexes['uc_a']['unique'])
    self.assert_(('uc_a' in constraints))
    reflected = Table('mysql_uc', MetaData(testing.db), autoload=True)
    indexes = dict(((i.name, i) for i in reflected.indexes))
    constraints = set((uc.name for uc in reflected.constraints))
    self.assert_(('uc_a' in indexes))
    self.assert_(indexes['uc_a'].unique)
    self.assert_(('uc_a' not in constraints))