diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-06-26 19:55:48 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-06-26 19:55:48 +0000 |
| commit | 49090a7a9434245b03a7f867add2401d3a78fead (patch) | |
| tree | c22b55212f6a0b843be63d35cff3b4fbb5f39c5a /test/base | |
| parent | 22fcdbe81f528a584eb499b9dbf2270365926b71 (diff) | |
| download | sqlalchemy-49090a7a9434245b03a7f867add2401d3a78fead.tar.gz | |
fixed attribute manager's ability to traverse the full set of managed attributes for a descendant class, + 2 unit tests
Diffstat (limited to 'test/base')
| -rw-r--r-- | test/base/attributes.py | 16 |
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 |
