From 9d08c6abc21dcf3d832897d38aaba84aeaa14fa6 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 9 Oct 2015 18:01:43 -0400 Subject: - Added the :paramref:`.AssociationProxy.info` parameter to the :class:`.AssociationProxy` constructor, to suit the :attr:`.AssociationProxy.info` accessor that was added in :ticket:`2971`. This is possible because :class:`.AssociationProxy` is constructed explicitly, unlike a hybrid which is constructed implicitly via the decorator syntax. fixes #3551 --- test/ext/test_associationproxy.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test/ext') diff --git a/test/ext/test_associationproxy.py b/test/ext/test_associationproxy.py index 8fb335b06..98e40b11e 100644 --- a/test/ext/test_associationproxy.py +++ b/test/ext/test_associationproxy.py @@ -1593,3 +1593,23 @@ class DictOfTupleUpdateTest(fixtures.TestBase): a1.elements.update, (("B", 3), 'elem2'), (("C", 4), "elem3") ) + + +class InfoTest(fixtures.TestBase): + def test_constructor(self): + assoc = association_proxy('a', 'b', info={'some_assoc': 'some_value'}) + eq_(assoc.info, {"some_assoc": "some_value"}) + + def test_empty(self): + assoc = association_proxy('a', 'b') + eq_(assoc.info, {}) + + def test_via_cls(self): + class Foob(object): + assoc = association_proxy('a', 'b') + + eq_(Foob.assoc.info, {}) + + Foob.assoc.info["foo"] = 'bar' + + eq_(Foob.assoc.info, {'foo': 'bar'}) -- cgit v1.2.1