diff options
| author | Chris Withers <chris@simplistix.co.uk> | 2010-02-23 17:17:08 +0000 |
|---|---|---|
| committer | Chris Withers <chris@simplistix.co.uk> | 2010-02-23 17:17:08 +0000 |
| commit | 165eda57336afd2fcc205a07bed662e021c81861 (patch) | |
| tree | ad9c82a235ec32f474832803b8c975a735c9cc1d /test/base/test_utils.py | |
| parent | da4d8dd69867f184347606284f1d4426facafe31 (diff) | |
| download | sqlalchemy-165eda57336afd2fcc205a07bed662e021c81861.tar.gz | |
a handy @classproperty decorator
Diffstat (limited to 'test/base/test_utils.py')
| -rw-r--r-- | test/base/test_utils.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/base/test_utils.py b/test/base/test_utils.py index e7e4116f7..035e4f268 100644 --- a/test/base/test_utils.py +++ b/test/base/test_utils.py @@ -980,3 +980,25 @@ class TestClassHierarchy(TestBase): eq_(set(util.class_hierarchy(A)), set((A, B, object))) # end Py2K + +class TestClassProperty(TestBase): + + def test_simple(self): + + from sqlalchemy.util import classproperty + + class A(object): + something = {'foo':1} + + class B(A): + + @classproperty + def something(cls): + d = dict(super(B,cls).something) + d.update({'bazz':2}) + return d + + eq_(B.something,{ + 'foo':1, + 'bazz':2, + }) |
