mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-05-11 03:10:38 -04:00
20cdc64588
become an externally usable package but still remains within the main sqlalchemy parent package. in this system, we use kind of an ugly hack to get the noseplugin imported outside of the "sqlalchemy" package, while still making it available within sqlalchemy for usage by third party libraries.
33 lines
841 B
Python
33 lines
841 B
Python
"""test the inspection registry system."""
|
|
|
|
from sqlalchemy import inspect
|
|
from sqlalchemy import Table, Column, Integer, MetaData
|
|
from sqlalchemy.testing import fixtures
|
|
from sqlalchemy.testing import is_
|
|
|
|
class TestCoreInspection(fixtures.TestBase):
|
|
|
|
def test_table(self):
|
|
t = Table('t', MetaData(),
|
|
Column('x', Integer)
|
|
)
|
|
|
|
is_(inspect(t), t)
|
|
assert t.is_selectable
|
|
is_(t.selectable, t)
|
|
|
|
def test_select(self):
|
|
t = Table('t', MetaData(),
|
|
Column('x', Integer)
|
|
)
|
|
s = t.select()
|
|
|
|
is_(inspect(s), s)
|
|
assert s.is_selectable
|
|
is_(s.selectable, s)
|
|
|
|
def test_column_expr(self):
|
|
c = Column('x', Integer)
|
|
is_(inspect(c), c)
|
|
assert not c.is_selectable
|
|
assert not hasattr(c, 'selectable') |