summaryrefslogtreecommitdiff
path: root/test/base
diff options
context:
space:
mode:
Diffstat (limited to 'test/base')
-rw-r--r--test/base/attributes.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/base/attributes.py b/test/base/attributes.py
index 4b8bfd39a..19eedd0f6 100644
--- a/test/base/attributes.py
+++ b/test/base/attributes.py
@@ -183,6 +183,22 @@ class AttributesTest(PersistTest):
assert x.element2 == 'this is the shared attr'
assert y.element2 == 'this is the shared attr'
+ def testinheritance2(self):
+ """test that the attribute manager can properly traverse the managed attributes of an object,
+ if the object is of a descendant class with managed attributes in the parent class"""
+ class Foo(object):pass
+ class Bar(Foo):pass
+ manager = attributes.AttributeManager()
+ manager.register_attribute(Foo, 'element', uselist=False)
+ x = Bar()
+ x.element = 'this is the element'
+ hist = manager.get_history(x, 'element')
+ assert hist.added_items() == ['this is the element']
+ manager.commit(x)
+ hist = manager.get_history(x, 'element')
+ assert hist.added_items() == []
+ assert hist.unchanged_items() == ['this is the element']
+
def testlazyhistory(self):
"""tests that history functions work with lazy-loading attributes"""
class Foo(object):pass