diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-09-02 16:07:46 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-09-02 16:07:46 +0000 |
| commit | d578d67035c519d4205e757c926392896e6a57e7 (patch) | |
| tree | 1c47ef1de153abdb112139a59abbf87342a61069 /test | |
| parent | 714e629aeb033e85fd4002bd959e10b8f2de227e (diff) | |
| download | sqlalchemy-d578d67035c519d4205e757c926392896e6a57e7.tar.gz | |
- Fixed custom instrumentation bug whereby get_instance_dict()
was not called for newly constructed instances not loaded
by the ORM.
Diffstat (limited to 'test')
| -rw-r--r-- | test/orm/extendedattr.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/orm/extendedattr.py b/test/orm/extendedattr.py index 8602f2681..4914bbd70 100644 --- a/test/orm/extendedattr.py +++ b/test/orm/extendedattr.py @@ -104,6 +104,21 @@ class UserDefinedExtensionTest(_base.ORMTest): clear_mappers() attributes._install_lookup_strategy(util.symbol('native')) + def test_instance_dict(self): + class User(MyClass): + pass + + attributes.register_class(User) + attributes.register_attribute(User, 'user_id', uselist = False, useobject=False) + attributes.register_attribute(User, 'user_name', uselist = False, useobject=False) + attributes.register_attribute(User, 'email_address', uselist = False, useobject=False) + + u = User() + u.user_id = 7 + u.user_name = 'john' + u.email_address = 'lala@123.com' + self.assert_(u.__dict__ == {'_my_state':u._my_state, '_goofy_dict':{'user_id':7, 'user_name':'john', 'email_address':'lala@123.com'}}) + def test_basic(self): for base in (object, MyBaseClass, MyClass): class User(base): |
