'Assert that a table\'s schema is what we expect.
:param string table: the name of the table to inspect
:param tuple expected_schema: a tuple of tuples containing the
expected schema
:raises AssertionError: when the database schema doesn\'t match the
expected schema
The expected_schema format is simply::
(\'column name\', sql type, qualifying detail),
The qualifying detail varies based on the type of the column::
- sql.Boolean columns must indicate the column\'s default value or
None if there is no default
- Columns with a length, like sql.String, must indicate the
column\'s length
- All other column types should use None
Example::
cols = ((\'id\', sql.String, 64),
(\'enabled\', sql.Boolean, True),
(\'extra\', sql.JsonBlob, None))
self.assertExpectedSchema(\'table_name\', cols)'

def assertExpectedSchema(self, table, expected_schema):

    table = self.select_table(table)
    actual_schema = []
    for column in table.c:
        if isinstance(column.type, sql.Boolean):
            default = None
            if column._proxies[0].default:
                default = column._proxies[0].default.arg
            actual_schema.append((column.name, type(column.type), default))
        elif (hasattr(column.type, 'length') and (not isinstance(column.type, sql.Enum))):
            actual_schema.append((column.name, type(column.type), column.type.length))
        else:
            actual_schema.append((column.name, type(column.type), None))
    self.assertItemsEqual(expected_schema, actual_schema)
