mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-05-10 19:00:25 -04:00
18abd47af3
Applied on top of a pure run of black -l 79 in I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9, this set of changes resolves all remaining flake8 conditions for those codes we have enabled in setup.cfg. Included are resolutions for all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I4f72d3ba1380dd601610ff80b8fb06a2aff8b0fe
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
"""test the inspection registry system."""
|
|
|
|
from sqlalchemy import Column
|
|
from sqlalchemy import inspect
|
|
from sqlalchemy import Integer
|
|
from sqlalchemy import MetaData
|
|
from sqlalchemy import Table
|
|
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")
|
|
|
|
def test_no_clause_element_on_clauseelement(self):
|
|
# re [ticket:3802], there are in the wild examples
|
|
# of looping over __clause_element__, therefore the
|
|
# absence of __clause_element__ as a test for "this is the clause
|
|
# element" must be maintained
|
|
|
|
x = Column("foo", Integer)
|
|
assert not hasattr(x, "__clause_element__")
|