summaryrefslogtreecommitdiff
path: root/test/sql/test_inspect.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-07-18 14:13:18 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-07-18 14:13:18 -0400
commitdff7c2ad2c913ed0ec5979ff9470dd5dd5813483 (patch)
tree6f1c6483f8bac9ac68820984ae9a3f8137e418b0 /test/sql/test_inspect.py
parent643a9afa86328ca6038d00543700dbe0f51af5e6 (diff)
downloadsqlalchemy-dff7c2ad2c913ed0ec5979ff9470dd5dd5813483.tar.gz
- document the inspection system
Diffstat (limited to 'test/sql/test_inspect.py')
-rw-r--r--test/sql/test_inspect.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/sql/test_inspect.py b/test/sql/test_inspect.py
new file mode 100644
index 000000000..9fcba16bd
--- /dev/null
+++ b/test/sql/test_inspect.py
@@ -0,0 +1,33 @@
+"""test the inspection registry system."""
+
+from sqlalchemy import inspect
+from sqlalchemy import Table, Column, Integer, MetaData
+from test.lib import fixtures
+from test.lib.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') \ No newline at end of file