summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-07-20 18:36:44 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-07-20 18:36:44 +0000
commit59b25a513a0c0fa934a66c80963221bec4c90e8b (patch)
treebdb3a629ebc5860c53d75dd3e8fbaca677aba7b8 /test
parent419753f59b6fa68ae282b5a75ad3b3a3b5f91c50 (diff)
downloadsqlalchemy-59b25a513a0c0fa934a66c80963221bec4c90e8b.tar.gz
- more accurate changelog message
- generalized the descriptor detection to any object with a __get__ attribute
Diffstat (limited to 'test')
-rw-r--r--test/orm/inheritance/basic.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/orm/inheritance/basic.py b/test/orm/inheritance/basic.py
index 4600ee063..da03d2f99 100644
--- a/test/orm/inheritance/basic.py
+++ b/test/orm/inheritance/basic.py
@@ -848,6 +848,29 @@ class OverrideColKeyTest(ORMTest):
sess.add(s1)
sess.flush()
assert sess.query(Sub).one().data == "im the data"
+
+ def test_custom_descriptor(self):
+ """test that descriptors prevent inheritance from propigating properties to subclasses."""
+
+ class MyDesc(object):
+ def __get__(self, instance, owner):
+ if instance is None:
+ return self
+ return "im the data"
+
+ class Base(object):
+ pass
+ class Sub(Base):
+ data = MyDesc()
+
+ mapper(Base, base)
+ mapper(Sub, subtable, inherits=Base)
+
+ s1 = Sub()
+ sess = create_session()
+ sess.add(s1)
+ sess.flush()
+ assert sess.query(Sub).one().data == "im the data"
if __name__ == "__main__":